map kinds of Ranges

Jonathan M Davis jmdavisProg at gmx.com
Mon May 23 22:08:38 PDT 2011


On 2011-05-23 22:02, Mehrdad wrote:
> On 5/23/2011 8:28 PM, Jonathan M Davis wrote:
> > 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
> 
> One question:
> Why make the syntax complicated for just a little gain? Wouldn't it kill
> a lot more birds with one stone if we allow for attributes?

They _are_ attributes. They're just not user-defined attributes. User-defined 
attributes can still be added later. Besides, the gain is _enormous_. Without 
conditional purity, conditional nothrow, conditional @safe, etc. most generic 
functions (including a large portion of Phobos) can never be pure, nothrow, 
@safe, etc.

- Jonathan M Davis


More information about the Digitalmars-d mailing list