map kinds of Ranges

KennyTM~ kennytm at gmail.com
Tue May 24 11:19:22 PDT 2011


On May 25, 11 01:25, Robert Clipsham wrote:
> On 24/05/2011 04:28, Jonathan M Davis wrote:
>>> Thoughts on this?
>>
>> I believe that the best and most likely to be implemented syntax which
>> has
>> been suggested (it was Andrei's idea IIRC) is to simply add optional
>> clauses
>> to attributes. So, instead of pure, you'd do pure(condition). If the
>> condition
>> is true, the templated function it's on is pure. If the condition is
>> false,
>> then the function isn't pure. Don't expect pure to become @pure or
>> nothrow to
>> become @nothrow though. I think that at this point, any attribute
>> which is a
>> keyword is going to stay one, and any attribute that has @ on the
>> front of it
>> is going to stay that way as well.
>>
>> - Jonathan M Davis
>
> Wouldn't it make sense to follow the same syntax as auto ref? auto pure,
> auto nothrow, auto @safe etc? (Although I guess that doesn't allow for
> conditions, nevermind :<)
>

public auto pure auto nothrow auto @safe auto ref front() const {
     return f(x.front);
}

:p

Actually I believe the point of having conditional attribute is to get 
the most restrictive one, where auto-attribute fit in better than the 
more generalized alternative.

Or we could just have an 'auto' condition to let the compiler choose the 
most restrictive one.

public pure(auto) nothrow(auto) @safe(auto) auto ref front() const {
    return f(x.front);
}

(still way too long :p)


More information about the Digitalmars-d mailing list