orivej has quit [Ping timeout: 256 seconds]
cole-h has quit [Quit: Goodbye]
orivej has joined #nixos-borg
adisbladis has joined #nixos-borg
cole-h has joined #nixos-borg
<
LnL>
man... how do you use traits without putting everything in a box
<
cole-h>
Depends on how you're trying to use it.
<
tilpner>
Or of course fn quuuux<T: Foo>(_foo: T) {}
<
cole-h>
If you need to pass around Trait objects, things start to get somewhat hairy (at least, in my current understanding)
* tilpner
is an expert at naming things
<
LnL>
hold on please tell me this isn't because I've been using dyn instead of an explicit reference with &dyn
<
tilpner>
What exactly have you been writing instead?
<
tilpner>
dyn isn't really necessary, just more explicit. But it doesn't work stand-alone
<
LnL>
it's the "I don't know the size of the value" errors I'm generally running into
<
tilpner>
Yes, that sounds right
<
tilpner>
Do try with &
<
LnL>
yeah that seem to be ok
<
LnL>
didn't realise you can use & with dyn
<
tilpner>
You can in fact leave the dyn off entirely, and it will change nothing
<
tilpner>
(But rustc will whine at you)
* cole-h
usually uses `impl Trait` over `&dyn Trait`
<
tilpner>
& is the important part here, not dyn
<
tilpner>
cole-h: That is not the same, and you know it :)
<
LnL>
well impl Trait only works when it can be inferred
<
tilpner>
Ehh, what do you mean?
<
LnL>
not sure how to describe it
<
tilpner>
(Who was that directed at?)
<
cole-h>
I don't know. I thought I was directing it at you, tilpner x)
* cole-h
is a self-admitted newb to type theory as well as somewhat deeper Rust topics like traits
<
cole-h>
Time to read the RFC!
<
tilpner>
I know what impl Trait does, at least superficially
<
tilpner>
But LnL said that like quuux and quuuux weren't equivalent
<
tilpner>
(They are not, strictly. Imagine quuuux with &T)
<
tilpner>
LnL: This is getting into nitpick territory, but Rust can actually infer the type of foo to be dyn Foo in your case
ekleog has quit [Quit: WeeChat 2.7.1]
ekleog has joined #nixos-borg
orivej has quit [Ping timeout: 260 seconds]