Improvement in pure functions specification

Meta via Digitalmars-d digitalmars-d at puremagic.com
Tue Dec 20 17:10:33 PST 2016


On Wednesday, 21 December 2016 at 00:58:38 UTC, Andrei 
Alexandrescu wrote:
> On 12/20/16 7:40 PM, Timon Gehr wrote:
>> On 20.12.2016 23:49, Andrei Alexandrescu wrote:
>>> https://github.com/dlang/dlang.org/pull/1528 -- Andrei
>>
>> Good, except:
>>
>> "$(P `pure` functions returning `void` will be always called 
>> even if it
>> is strongly `pure`. The implementation must assume the 
>> function does
>> something outside the confines of the type system and is 
>> therefore not
>> allowed to elide the call, even if it appears to have no 
>> possible effect.)"
>>
>> I think this makes no sense. What is the idea behind this 
>> paragraph?
>
> A function that traces execution via a debug statement, for 
> example. -- Andrei

The compiler will have to be changed for this part. Currently 
it's a warning (or maybe it was an error, can't remember) to call 
a strongly pure function returning void without doing 
`cast(void)fun()`.


More information about the Digitalmars-d mailing list