14:53 PM
nmatsakis
e.g., prefer exhaustive matches, etc
14:54 PM
centril
nox: that was just a quick example... consider a more complicated default value
14:54 PM
nox
Then write Default::default()?
14:55 PM
eddyb
trait _ { fn _() -> Self; }
14:55 PM
_::_()
14:55 PM
centril
nox: This was predicated on repeating Default::default() being annoying
14:55 PM
nox
eddyb: -> _ you mean
14:55 PM
centril: Annoying to write ≠ bad to have.
14:56 PM
centril
anywho... let's get started?
14:56 PM
nox: ^
14:56 PM
nox
Wait a sec,
14:56 PM
eddyb
sorry r#_
14:56 PM
centril
k, i'll go make some tea
14:56 PM
nox
isn't there a RFC to write struct with named fields as struct tuples?
14:57 PM
Or am I crazy?
14:58 PM
centril
nox: like this? struct Foo { bar: usize, baz: u8 } Foo(0, 1) ?
14:58 PM
nox
Yeah.
14:58 PM
centril: Doesn't matter anyway.
14:58 PM
centril
nox: are you in favor of that?
14:58 PM
nox
centril: Nah,
14:58 PM
centril
aight
14:58 PM
nox
I was just wondering if Foo { .. } could be confusing,
14:59 PM
centril
don't think so
14:59 PM
nox
if it could be written as Foo(..) when the first field is RangeFull,
14:59 PM
but Default::default() for RangeFull returns .. anyway so it's not like it would matter.
15:00 PM
centril
but it is good to think about
15:02 PM
paulgdp joined the channel
15:02 PM
nox
centril: Imma relocate to home (I'm in a café) and then we can discuss the RFC.
15:03 PM
albel727 performs DerefMove on a Box<Nox>
15:05 PM
centril
Boxing nox in a nox box effing rocks
15:05 PM
albel727
best rap evar
15:05 PM
nox
Now that's my kind of highlights.
15:06 PM
Usually being highlighted by my name in technical stuff means someone said a Debian package name that has no X support.
15:06 PM
albel727
hah
15:06 PM
centril
=P
15:07 PM
nox is a pretty rhymable nick
15:07 PM
paulgdp has quit
15:07 PM
paulgdp joined the channel
15:08 PM
albel727
and X it's the coolest consonant
15:08 PM
s/t'//
15:08 PM
centril
the ks sound generally
15:08 PM
albel727
(well, two)
15:09 PM
coolest letter and coolest two consonants
15:11 PM
centril
nox, rocks, socks, docks, pox, clocks, box, Xerox, fox, glocks, flocks, locks, detox
15:17 PM
sinesc joined the channel
15:17 PM
oln joined the channel
15:17 PM
nox
Good job avoiding one of them.
15:17 PM
centril
nox: what did I avoid? =P
15:17 PM
nox
Lalala.
15:18 PM
Obviously meant avoiding MOx because nuclear energy is bad.
15:18 PM
paulgdp has quit
15:19 PM
paulgdp joined the channel
15:22 PM
centril
15:26 PM
nox
centril: "T: Debug" in there requires a different RFC, that's not even currently parsed.
15:26 PM
centril
yea but we have to consider it for future compat
15:26 PM
nox
centril: I also don't understand what that means in bound,
15:26 PM
if bound takes a list of traits that is.
15:27 PM
paulgdp has quit
15:27 PM
paulgdp joined the channel
15:31 PM
paulgdp has quit
15:31 PM
paulgdp joined the channel
15:43 PM
paulgdp has quit
16:07 PM
sinesc has quit
16:07 PM
centril: Real world code called, btw.
16:09 PM
Ericson2314 joined the channel
16:15 PM
centril
nox: hmm? =P
16:15 PM
nox
centril: I am patching some CSS stuff, just saying I'm not giving you the cold shoulder. :P
16:15 PM
centril
nox: ah, np =)
16:21 PM
nox
centril: Want me to slim down my stuff using the associated type from a trait?
16:21 PM
centril
nox: if you think that is best for understanding =)
16:26 PM
nox
16:26 PM
centril: It's just a complex enough to show that #[no_bound] is obviously necessary in that case.
16:26 PM
-a
16:27 PM
centril
nice
16:27 PM
nox
centril: And main doesn't actually use NumberOrPercentage because… I can't implement Debug for it.
16:27 PM
centril: Oh I guess I should write the impl by hand anyway to show what no_bound+bound should produce.
16:27 PM
centril
Recursive was actually a really neat example
16:28 PM
since F should not have Debug but B should
16:28 PM
Jesin has quit
16:33 PM
nox
centril: Interesting, I just hit a rustc limitation that makes #[bound] etc not help me as much as I would like to minimise the sample. :(
16:33 PM
centril
:(
16:33 PM
niconii joined the channel
16:33 PM
we can discuss it perhaps in a limitations section if you like
16:34 PM
nox
16:34 PM
Grep for XXX
16:34 PM
Somehow the type alias (that isn't passed any generic type) isn't resolved there.
16:36 PM
centril
interesting
16:38 PM
nox
16:38 PM
Line 36 is equivalent to line 37, but with line 36 it doesn't compile.
16:40 PM
centril: This definitely looks like a bug, right?
16:44 PM
centril
sec, have to think =P
16:46 PM
nox
It chokes with Phase: Phasing<<Specified as Phasing<SpecifiedNumber>>::Output> even though <Specified as Phasing<SpecifiedNumber>>::Output == SpecifiedNumber.
16:46 PM
centril: I'm most confused by the fact that it chokes only in the impl and not the enum definition.
16:47 PM
sleffy joined the channel
16:49 PM
centril
1. assume: type Number<Phase> = <Phase as Phasing<SpecifiedNumber>>::Output; , impl<T> Phasing<T> for Specified { type Output = T; } 2. Number<Specified> ==> SpecifiedNumber 3. Phasing<Number<Specified>> == Phasing<SpecifiedNumber>
16:49 PM
feels like it should work by simple substitution
16:49 PM
nox
Yep.
16:49 PM
centril: And that bound is necessary on the enum definition,
16:50 PM
so the fact that it doesn't choke there isn't just a matter of trait bounds being ignored on type items or whatever.
16:50 PM
Right?
16:50 PM
centril
Feels like a bug, but then again, when you say such things someone always comes along and shows that you that you are wrong =P
16:50 PM
nox
I've been told nmatsakis is the trait bound master, let's just wait for him to wake up.
16:51 PM
centril
This is correct
16:51 PM
nox
"Trait bound master",
16:51 PM
somehow that reminds me of…
16:52 PM
16:52 PM
nox knows a lot of very bad TV shows.
16:52 PM
centril
trait bound master vs. bound trait master vs. bound master trait vs. master-bound trait vs. trait-master bound
16:52 PM
english is fun
17:06 PM
sleffy has quit
17:28 PM
scott has quit
17:29 PM
scott joined the channel
17:38 PM
nox: I've been thinking that #[no_bound] should be permitted on fields as well
17:38 PM
nox
centril: Why?
17:39 PM
centril
nox: scroll to where I am
17:39 PM
nox
Oh.
17:40 PM
centril: "Bound for all traits, but not those ones?"
17:41 PM
centril
nox: it means: "ignore this field when adding bounds to type parameters"
17:41 PM
nox
I'm confused.
17:42 PM
centril: Ah, if T appears only in fields with #[no_bound], T doesn't get a bound?
17:42 PM
centril
exactly
17:42 PM
nox
That sounds more complex to implement syntactically,
17:42 PM
you now need name resolution.
17:42 PM
I would rather we limit ourselves to things that don't require that.
17:42 PM
(For now at least.)
17:42 PM
centril
sure, you'd need to scan all fields and see if a type parameter is referenced
17:43 PM
but we can simplify that with helper crates
17:43 PM
the upside is that it reads better in complex cases
17:43 PM
nox
centril: Sure, but name resolution is complicated and will get more complicated.
17:43 PM
I'm also not sure that type macros are expanded before derive macros,
17:43 PM
and type params aren't hygienic.
17:43 PM
centril
nox: hmm; let's put this as an unresolved question then?
17:43 PM
nox
macro_rules! Foo { () => { T } }
17:44 PM
struct Bar<T>(Foo!());
17:44 PM
What does that do?
17:44 PM
This builds, *wonderful*.
17:45 PM
kimundi joined the channel
17:45 PM
centril
there are proposals that allow derive to type macros at will
17:45 PM
to expand type macros*
17:45 PM
nox
I'm not sure I parse that correctly.
17:45 PM
Oh.
17:46 PM
centril: Unresolved it is.
17:46 PM
centril
but it could get hairy...
17:46 PM
=)
17:46 PM
nox
We don't really need the use case for now.
17:46 PM
centril: But what do you think of my interpretation btw?
17:46 PM
centril
of?
17:47 PM
nox
#[bound] #[no_bound(Clone)], with #[derive(PartialEq, Clone, PartialOrd)]
17:48 PM
centril
what are the semantics?
17:49 PM
nox
centril: Adds a PartialEq + PartialOrd bound for that field type.