I was thinking not. The dot operator should still have special name lookup 
rules: it searches through associated impls and all traits in scope. It cannot 
call anything that is not attached to an impl.

This does make functions and methods somewhat less unified, but it makes 
methods feel more like OO methods from a scoping POV. I feel the draws of 
methods are not only that they switch the order of the receiver and action but 
also that they allow functions associated with a type to be called without 
explicitly importing their names.

Patrick

Ziad Hatahet <[email protected]> wrote:
>On Sat, Oct 19, 2013 at 1:52 PM, Patrick Walton <[email protected]>
>wrote:
>
>> I think it's unfortunately too late to overhaul the language like
>this.
>> This will require redesigns of all Rust code in existence.
>>
>> I do like unified function/method call syntax, but I think it can be
>done
>> in a backwards compatible way.
>>
>>
>What do you have in mind at the moment? Implementing UFCS while still
>keeping the `impl` syntax around for structs? What about for primitive
>types, e.g. would `fn double(a: int) -> { 2*a }` be callable as
>`2.double()`, without breaking backward compatibility?
>
>Thanks
>
>
>--
>Ziad

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to