Re: [RFC PATCH 0/2] impl specialization and lookup changes
[Thread Prev] | [Thread Next]
- Subject: Re: [RFC PATCH 0/2] impl specialization and lookup changes
- From: Ori Bernstein <ori@xxxxxxxxxxxxxx>
- Date: Sun, 2 Jul 2017 13:23:40 -0700
- To: Quentin Carbonneaux <quentin@xxxxxx>
- Cc: Michael Forney <mforney@xxxxxxxxxxx>, myrddin-dev@xxxxxxxxxxxxxx
On Sun, 2 Jul 2017 14:52:00 +0000, Quentin Carbonneaux <quentin@xxxxxx> wrote: > On Sat, Jul 01, 2017 at 10:28:58PM -0700, Ori Bernstein wrote: > > The interesting part in this example is that the type > > of the expression here might have no relation to the > > type that the trait is specialized over. > > Ah that's right! I focused too much on the first > example. Type hints would be of no use in the > second one. So it looks like something else is > really necessary. Bah, I was hoping you had one of those magic solutions. > Syntax does not count much, though. So I'm > totally fine with Michael's suggestion. Syntax does matter -- it's nice having something cohesive, something that flows and doesn't make me think about what comes next as I type. It might be good to think of this as 'cast to trait', and reuse the cast syntax, just with the 'trait-of' operator instead of the 'type-of' operator: str = (Def :: trait) That being said, it's not intrusive, and not worth bikeshedding over too much. The functionality is useful, and I'll just make a breaking change if/when we think of something nicer. I've been wanting to redo the way that traits are specified over type params, so there's a good chance we can look at the syntax here in light of that. Aside: The specific problem I'm trying to solve with the trait syntax is that it's impossible to depend or use aux types in trait specifiers with the current syntax. So, you can say `must be iterable`, but there's no way to specify that the iterator must return integers, for example. -- Ori Bernstein
[RFC PATCH 0/2] impl specialization and lookup changes | Michael Forney <mforney@xxxxxxxxxxx> |
Re: [RFC PATCH 0/2] impl specialization and lookup changes | Quentin Carbonneaux <quentin@xxxxxx> |
Re: [RFC PATCH 0/2] impl specialization and lookup changes | Ori Bernstein <ori@xxxxxxxxxxxxxx> |
Re: [RFC PATCH 0/2] impl specialization and lookup changes | Quentin Carbonneaux <quentin@xxxxxx> |
- Prev by Date: Re: [RFC PATCH 0/2] impl specialization and lookup changes
- Next by Date: Re: [RFC PATCH 2/2] Specialize impl declarations on impl type in addition to decl type
- Previous by thread: Re: [RFC PATCH 0/2] impl specialization and lookup changes
- Next by thread: [PATCH] Allow matching of empty structs and arrays
- Index(es):