Using import in map

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Sun Feb 1 04:28:44 PST 2015


On Sunday, 1 February 2015 at 12:21:59 UTC, Jacob Carlborg wrote:
> On 2015-02-01 11:53, Dicebot wrote:
>
>> Original snippet shouldn't compiler because landa argument is 
>> run-time
>> one but `import` must work at CT.
>
> It is resolved at compile time. Is this a CTFE vs CT problem?

CTFE function is still considered runtime function in terms of 
restrictions because generally there is no way to tell what 
context it will be evaluated in. In this specific case it is 
clear but making use of it would require brand new language spec. 
Your code is similar to this:

int foo (string s) { pragma(msg, s); return 42; }

enum ct = foo("str");


More information about the Digitalmars-d mailing list