[rust-dev] A couple of tweaks to make typeclasses easier?

Patrick Walton pwalton at mozilla.com
Thu Jan 26 17:41:44 PST 2012


On 1/26/12 5:38 PM, Graydon Hoare wrote:
> On 1/25/2012 12:12 PM, Patrick Walton wrote:
>
>> (1) Typeclass imports become "import impl". So you'd write "import impl
>> driver::diagnostic::handler" where you'd write "import
>> driver::diagnostic::handler" today. This way, when you look at a method
>> call and you don't know where it's coming from, you just grep for
>> "import impl" and look at all the implementations in scope.
>>
>> (2) Change method calls to '->', like C++, Perl, and PHP. That operator
>> is free and it has precedent. And getting away from overloading the dot
>> worked well when we changed module access from '.' to '::'.
>>
>> Thoughts?
>
> A bit opposed to both, sadly. I quite like picking up impls "by
> accident" via "import foo::*", and dislike the aesthetic of ->.

Is "import impl foo::*" bad?

> Is the ambiguity between field-access and method-call really biting in
> actual cases? Users really seem to adore '.' as a sub-component
> accessor. We even have people wanting us to go back to '.' for
> module-separator :)

Yes, I found it very confusing yesterday, when trying to figure out "." 
with a closure. It's also screwing up our error messages.

Patrick


More information about the Rust-dev mailing list