patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Alyssa Ross <hi@alyssa.is>
To: Cole Helbling <cole.e.helbling@outlook.com>
Cc: devel@spectrum-os.org
Subject: Re: [PATCH crosvm 1/2] msg_socket: introduce UnixSeqpacketExt
Date: Tue, 23 Jun 2020 02:32:25 +0000	[thread overview]
Message-ID: <87a70u8qbq.fsf@alyssa.is> (raw)
In-Reply-To: <CH2PR14MB3579DD94ED9CDFE54ADAB43BB3970@CH2PR14MB3579.namprd14.prod.outlook.com>

[-- Attachment #1: Type: text/plain, Size: 3256 bytes --]

>> Both 1 and 3 would provide full compile-time type safety, at the expense
>> of being a bit more horrible than 2.  I think I'm leaning towards 1, but
>> I don't have strong feelings about any of them.  Having thought about
>> this now though, in response to your question (thanks!), I definitely
>> think that we should do something here better than what I presented in
>> these patches.
>>
>> I'd be very curious to hear your thoughts.
>
> I think that options 1 or 3 are the best choices. My only qualm with
> option 1 is that it uses a callback. I can't even really explain *why* I
> don't like callbacks (maybe because I had a bad time trying to use them
> within Rust before, when I was lacking experience), but it just feels
> somehow wrong to me. (Maybe it's also because I stereotype callbacks to
> C -- which isn't necessarily a bad thing -- but it would certainly make
> me happier to find a more Rust-y way to approach this.)
>
> Thinking about it for a little bit longer, I'm leaning a bit more
> towards option 3, just because I think it would be a better idea to
> associate a trait and a socket type. My gut feeling (keeping in mind my
> very brief knowledge of traits, and even less in that of callbacks) is
> that this would end up being nicer to implement, though maybe not as
> simple.

In the time since I last posted, I've been leaning towards option 1.
But I don't really like callbacks either.  I think the main reason for
me is that then it's not really obvious what the function _does_.  It
some cases (if the callback returned false) it wouldn't actually do
anything at all, which feels a bit weird.  What would a good name for
such a function be?  It becomes very difficult.

On the other hand, making every enum variant a struct of its own feels
like a hack around a limitation of Rust, and it's a lot of boilerplate.
The size of the change puts me off it.

I think I'll probably have to try both out and see what feels best.

>> You might also be interested in implementing one of them.  Would be a
>> good starter crosvm exercise.  It's probably the type of thing where you
>> could be pretty confident you'd got it right if it compiled, but I could
>> offer some guidance on testing it as well, if you wanted.  If not,
>> though, please give me your thoughts on approach anyway, and I'll
>> implement whichever one we think is best myself at some point. :)
>
> Although I would be interested in implementing one of them (#3,
> specifically), time is not on my side at the moment. I've recently
> started my first 40-hour-per-week job, so I'd like to adjust to that
> schedule before I really start doing things again.

Oh, congratulations!  Definitely let yourself adjust to the job as a
priority!

>> I'll definitely wait longer to push crosvm patches in future, now that I
>> know somebody might be looking at them!
>
> Don't worry about it; it's because I took so long to respond. :P

Didn't you respond, like, the next day? :P

> P.P.S. Thanks for going into such detail in all your responses (and
> apologies for not doing the same)!

No worries!  It was really useful to have somebody on the other end to
go into detail to, because otherwise I wouldn't have thought about this
so much and come to the decision I did.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2020-06-23  3:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-14 11:43 [PATCH crosvm 0/2] Fix deadlock on early VmRequest Alyssa Ross
2020-06-14 11:43 ` [PATCH crosvm 1/2] msg_socket: introduce UnixSeqpacketExt Alyssa Ross
2020-06-16  0:17   ` Cole Helbling
2020-06-16  9:32     ` Alyssa Ross
2020-06-22 22:06       ` Cole Helbling
2020-06-23  2:32         ` Alyssa Ross [this message]
2020-06-25  1:54       ` impaqt
2020-07-09 13:24         ` Alyssa Ross
2020-06-14 11:43 ` [PATCH crosvm 2/2] crosvm: fix deadlock on early VmRequest Alyssa Ross
2020-06-16  1:08   ` Cole Helbling
2020-06-16  9:39     ` Alyssa Ross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a70u8qbq.fsf@alyssa.is \
    --to=hi@alyssa.is \
    --cc=cole.e.helbling@outlook.com \
    --cc=devel@spectrum-os.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).