[phobos] Pureness of enforce()
Robert Jacques
sandford at jhu.edu
Tue Nov 9 10:38:22 PST 2010
On Tue, 09 Nov 2010 11:34:57 -0500, Don Clugston
<dclugston at googlemail.com> wrote:
> On 9 November 2010 16:15, Robert Jacques <sandford at jhu.edu> wrote:
>> On Tue, 09 Nov 2010 06:21:38 -0500, Lars Tandle Kyllingstad
>> <lars at kyllingen.net> wrote:
>>> It is not possible to annotate
>>> enforce() with 'pure', however, because it takes a lazy parameter,
>>> which
>>> is just shorthand for a (possibly impure) delegate.
>
>> Well, long term, we need modifiers to apply to delegates. i.e. it
>> should be
>> possible to declare a pure delegate.
>
> You can already do that.
>
> int delegate(int x, int y) pure @safe foo;
Cool. I love being out of date. :) Although, some syntactic sugar (or
auto-magical detection) for the pure delegate literal would be nice, as
'delegate() @safe pure{return 5;}' is a lot more clunky than '(){return
5;}' or the just '5' if the function takes an 'int delegate() pure @safe
foo[]...'
More information about the phobos
mailing list