On 12/21/2016 04:42 PM, Johan Engelen wrote:
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
```

Well randomness is not available in pure functions. Anyhow I've reformulated the wording and added an example. The sheer fact it works is pretty awesome.

https://github.com/dlang/dlang.org/pull/1528

For now I didn't want to give thrown values any special treatment, i.e. maximum freedom for the implementation.


Andrei

Reply via email to