[Issue 5006] 'pure' unenforced in a nested function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 26 15:35:03 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=5006



--- Comment #2 from bearophile_hugs at eml.cc 2010-10-26 15:34:16 PDT ---
It seems currently (2.050alpha) nested functions can't be pure:


import std.traits: FunctionAttribute, functionAttributes;
void main() {
    static pure int foo1(int x) { return x; }
    pure int foo2(int x) { return x; }
    static assert(functionAttributes!(foo1) & FunctionAttribute.PURE); //
asserts
    static assert(functionAttributes!(foo2) & FunctionAttribute.PURE); //
asserts

}
void main() {}


This is a problem because I'd like many functions of std.algorithm to be weakly
pure. Many high order functions take an optional delegate argument, so if
there's no handy way to build a pure delegate, they become less useful.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list