Improvement in pure functions specification
Johan Engelen via Digitalmars-d
digitalmars-d at puremagic.com
Wed Dec 21 13:42:44 PST 2016
On Wednesday, 21 December 2016 at 21:34:04 UTC, Andrei
Alexandrescu wrote:
> On 12/21/2016 03:04 PM, Johan Engelen wrote:
>
>> Super contrived, but I hope you get my drift:
>> ```
>> int *awesome() pure {
>> static if (ohSoAwesome) {
>> return new int;
>> } else {
>> return null;
>> }
>> }
>> ```
>
> Where does ohSoAwesome come from?
A random bool.
Perhaps something like this:
```
version(LDC)
ohSoAwesome = true;
else
ohSoAwesome = false
```
;-)
Johan
More information about the Digitalmars-d
mailing list