Michel Fortin wrote:
On 2009-12-25 09:13:13 -0500, Andrei Alexandrescu <[email protected]> said:

Anyway, I dropped the suggestion due to the array slice example, but I still think this is a serious problem with D.

If you could pass "this" by value instead of ref, it'd solve the problem nicely:

    struct MyRange {
        MyRange opSlice(int, int) @byvalue;
        void length(int) @property;
    }

Here you can call opSlice on a lvalue since it takes the "this" argument by value, but you can't call length(int) because it takes it by ref.


I've seen that. The only problem I see with that is that it complicates the language. Ideally some sort of inference could be applicable.

Andrei

Reply via email to