map kinds of Ranges
Jonathan M Davis
jmdavisProg at gmx.com
Mon May 23 20:28:22 PDT 2011
On 2011-05-23 20:18, Mehrdad wrote:
> On 5/23/2011 7:33 PM, Jonathan M Davis wrote:
> > Setting aside this particular issue with purity, I would very much
> > like to see conditional purity implemented (along with conditional
> > nothrow, conditional @safe, etc.),
>
> I'm liking that people are liking the idea. :-)
> http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group
> =digitalmars.D&artnum=127569
> <http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&gro
> up=digitalmars.D&artnum=127569>
>
> As much as I like the idea, though, I think a /lot/ of these would be
> fixed simply with the ability to put metadata/attributes/annotations,
> instead of introducing new syntax like conditionally_pure, etc. That
> way, @pure, @nothrow, @safe, etc. could just become attributes that
> could take in arguments, and it would also simply the syntax of the
> language a bit, reducing the number of keywords. It would also add one
> major feature D lacks right now (metadata) that is really helpful in a
> lot of situations.
>
> 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
More information about the Digitalmars-d
mailing list