Improvement in pure functions specification

Johan Engelen via Digitalmars-d digitalmars-d at puremagic.com
Wed Dec 21 13:38:24 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:
>> 
>> ```
>> I don't know what "required to honor all calls" means, but I 
>> guess it means
>> ```
>> auto a = foo(); // int* foo() pure;
>> auto b = foo();
>> ```
>> cannot be transformed to
>> ```
>> auto a = foo(); // int* foo() pure;
>> auto b = a;
>> ```
>
> That is correct.

Is that _all_ it is saying? Or is it also saying this:
```
void bar() {
    auto a = foo(); // int* foo() pure;
}

// cannot remove the call to bar, because bar calls a pure 
function and all calls must be "honored"
bar();
```



More information about the Digitalmars-d mailing list