digitalmars.D.learn - Attribute introspection
- bearophile (4/4) Apr 22 2009 Are there ways in D2 to tell if a function has the 'pure' attribute?
- Don (12/17) Apr 22 2009 It's easy enough if it's a function pointer or delegate:
Are there ways in D2 to tell if a function has the 'pure' attribute? (To create a parallel_map() function we will want to be sure it takes a pure mapping function as argument). Bye, bearophile
Apr 22 2009
bearophile wrote:Are there ways in D2 to tell if a function has the 'pure' attribute? (To create a parallel_map() function we will want to be sure it takes a pure mapping function as argument). Bye, bearophileIt's easy enough if it's a function pointer or delegate: int foo(T, U...)(T function(U) pure x) { return 7; } void main() { int function(int) pure p=null; int function(int) q = null; foo(p); // OK // foo(q); // won't compile. }
Apr 22 2009