map kinds of Ranges

Jonathan M Davis jmdavisProg at gmx.com
Mon May 23 22:51:49 PDT 2011


On 2011-05-23 22:22, Mehrdad wrote:
> On 5/23/2011 10:08 PM, Jonathan M Davis wrote:
> > On 2011-05-23 22:02, Mehrdad wrote:
> >> 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
> 
> Wait, what? I never said we shouldn't include conditional stuff, I just
> said they should be with @attributes rather than keywords, because that
> would somewhat simplify the syntax (fewer keywords, although attribute
> syntax is added) and unify things.
> 
> So the question was: Why not make @pure, etc. become regular metadata?
> That way the syntax would likely turn out the same as user-defined
> attributes.

The decision was made a while ago to make the attributes which are keywords 
keywords and the ones which start with @ start with @. It was a bit arbitrary, 
but the decision was made. Changing it now would break a lot of code for 
little benefit, and I'd be _very_ surprised if you could talk Walter into it. 
And it's not like an objective decision can really be made about which start 
with @ and which don't anyway. Arguments could be made either way for all of 
them. And honestly, I don't expect that it would be much more complicated (if 
any more complicated at all) to implement pure(condition) than 
@pure(condition). I don't think that the compiler treats the keyword 
attributes and the @ attributes much differently at this point anyway. And 
even if user-defined attributes were added, I don't think that it would really 
matter what was done with the keyword attributes and @ attributes which are 
built in. They'd likely be acting differently anyway.

@ vs keyword is one of those things that you stand little chance of getting 
changed in the language at this point.

- Jonathan M Davis


More information about the Digitalmars-d mailing list