How to break const

Timon Gehr timon.gehr at gmx.ch
Tue Jun 19 04:29:34 PDT 2012


On 06/19/2012 01:24 PM, Iain Buclaw wrote:
> On 19 June 2012 12:04, Timon Gehr<timon.gehr at gmx.ch>  wrote:
>> On 06/19/2012 12:49 PM, Iain Buclaw wrote:
>>>  ...
>>> pure const - similar to strongly pure, as is guaranteed not to be able
>>> to alter its own state (as it's const), but still may have side
>>> effects / throw an exception.
>>>
>>
>> Therefore, you think 'pure const' should be allowed to have side effects?
>>
>
> Throwing exceptions is a bit of a side effect...
>

It is not. Any pure function can be turned into a pure nothrow function
by making the thrown exception an 'out' parameter and updating all
callers accordingly.





More information about the Digitalmars-d mailing list