digitalmars.D - Using import in map
- Jacob Carlborg (7/7) Jan 31 2015 Is this supposed to work:
- Stefan Koch (4/11) Jan 31 2015 I think this is not supposed to work.
- Jacob Carlborg (6/8) Jan 31 2015 Yes, staticMap worked, thanks. I filed a bug [1]. If I recall correctly,...
- Dicebot (6/13) Feb 01 2015 Is it? "__error" is simply a placeholder for type of expression
- Daniel Murphy (3/7) Feb 01 2015 Yeah, only the first error should be shown and the second should be
- Jacob Carlborg (4/6) Feb 01 2015 It is resolved at compile time. Is this a CTFE vs CT problem?
- Dicebot (8/13) Feb 01 2015 CTFE function is still considered runtime function in terms of
Is this supposed to work: enum foo = ["foo"].map!((string e) => import(e)); When I compile the above code with 2.066.1 I get the following error: main.d(1): Error: variable e cannot be read at compile time main.d(1): Error: file name argument must be a string, not (__error) -- /Jacob Carlborg
Jan 31 2015
On Saturday, 31 January 2015 at 19:52:11 UTC, Jacob Carlborg wrote:Is this supposed to work: enum foo = ["foo"].map!((string e) => import(e)); When I compile the above code with 2.066.1 I get the following error: main.d(1): Error: variable e cannot be read at compile time main.d(1): Error: file name argument must be a string, not (__error)I think this is not supposed to work. try staticMap maybe ?
Jan 31 2015
On 2015-01-31 20:54, Stefan Koch wrote:I think this is not supposed to work. try staticMap maybe ?Yes, staticMap worked, thanks. I filed a bug [1]. If I recall correctly, if the compiler outputs a message which includes "__error" it's a bug. [1] -- /Jacob Carlborg
Jan 31 2015
On Saturday, 31 January 2015 at 21:09:44 UTC, Jacob Carlborg wrote:On 2015-01-31 20:54, Stefan Koch wrote:Is it? "__error" is simply a placeholder for type of expression that can't be deduced because of compilation error. Original snippet shouldn't compiler because landa argument is run-time one but `import` must work at CT.I think this is not supposed to work. try staticMap maybe ?Yes, staticMap worked, thanks. I filed a bug [1]. If I recall correctly, if the compiler outputs a message which includes "__error" it's a bug. [1]
Feb 01 2015
"Dicebot" wrote in message news:jscikdikdbjxlkcwybtd forum.dlang.org...Yes, staticMap worked, thanks. I filed a bug [1]. If I recall correctly, if the compiler outputs a message which includes "__error" it's a bug.Is it? "__error" is simply a placeholder for type of expression that can't be deduced because of compilation error.Yeah, only the first error should be shown and the second should be supressed because it refers to an earlier error.
Feb 01 2015
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? -- /Jacob Carlborg
Feb 01 2015
On Sunday, 1 February 2015 at 12:21:59 UTC, Jacob Carlborg wrote:On 2015-02-01 11:53, Dicebot wrote: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");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?
Feb 01 2015