digitalmars.D - Just curious: who do know current purity rules?
- Denis Shelomovskij (18/18) Jun 06 2014 As Kenji Hara just created purity fixing pull [1] we will probably soon
- Kagamin (2/2) Jun 06 2014 Do you mean true purity rules or whatever is implemented in the
- Denis Shelomovskij (5/6) Jun 06 2014 "whatever is implemented". )
- deadalnix (2/6) Jun 06 2014 Do someone know whatever is implemented ? I certainly don't.
As Kenji Hara just created purity fixing pull [1] we will probably soon have more intuitive rules so it's interesting who do understand current purity rules. The following code is proposed to check your understanding: --- alias F = bool function(int) pure; alias D = bool delegate(int) pure; D foo1(immutable F f) pure { return x => (*f)(x); } // ok or error? D foo2( const F f) pure { return x => (*f)(x); } // ok or error? D foo1(immutable F* f) pure { return x => (*f)(x); } // ok or error? D foo2( const F* f) pure { return x => (*f)(x); } // ok or error? --- Who passes this test? By "pass" I mean completely understand what the compiler do and why. By the way, personally I would fail the test. ) [1] [spoiler!] https://github.com/D-Programming-Language/dmd/pull/3626 -- Денис В. Шеломовский Denis V. Shelomovskij
Jun 06 2014
Do you mean true purity rules or whatever is implemented in the compiler?
Jun 06 2014
06.06.2014 13:05, Kagamin пишет:Do you mean true purity rules or whatever is implemented in the compiler?"whatever is implemented". ) -- Денис В. Шеломовский Denis V. Shelomovskij
Jun 06 2014
On Friday, 6 June 2014 at 19:32:17 UTC, Denis Shelomovskij wrote:06.06.2014 13:05, Kagamin пишет:Do someone know whatever is implemented ? I certainly don't.Do you mean true purity rules or whatever is implemented in the compiler?"whatever is implemented". )
Jun 06 2014