digitalmars.D - Functions cannot be interpreted while being compiled
- Andrei Alexandrescu (2/2) Aug 24 2016 Just got the error above. Is this fundamental or an implementation
- ketmar (15/17) Aug 24 2016 fundamental. interpreter operates only on fully semanticed
- Walter Bright (6/20) Aug 24 2016 From the test suite:
- ketmar (6/7) Aug 24 2016 yeah, this is it. template instantiation wants semantic, and we
- ketmar (2/2) Aug 24 2016 p.s. i just thought that Andrei hits this somewhere in his own
- Walter Bright (3/5) Aug 24 2016 It's fine if Andrei produces a sample, and it can be compared with the e...
- Andrei Alexandrescu (3/9) Aug 25 2016 It's similar. I got convinced my code was attempting something
- Timon Gehr (15/26) Aug 24 2016 (The remainder of the post is describing implementation details; this
Just got the error above. Is this fundamental or an implementation artifact? -- Andrei
Aug 24 2016
On Thursday, 25 August 2016 at 02:20:31 UTC, Andrei Alexandrescu wrote:Just got the error above. Is this fundamental or an implementation artifact? -- Andreifundamental. interpreter operates only on fully semanticed functions, where all the analysis, type inferencing and lowering is already complete (otherwise interpreter have to reimplement *all* the frontend again, to do exactly same work). the error mesage you got means that CTFE tried to execute something that is still in semantic analysis stage. this *may* be somewhat relaxed by doing lazy semantic (i.e. only mark something for "future analysis", and do real thing when interpreter/compiler really need semantic results), but it will require a huge efforts to implement this in current FE architecture. still, this may be some obscure bug in semantic analyser, so it will be good to see a minified sample that triggers this.
Aug 24 2016
On 8/24/2016 8:11 PM, ketmar wrote:On Thursday, 25 August 2016 at 02:20:31 UTC, Andrei Alexandrescu wrote:From the test suite: diag8714.d:fail_compilation/diag8714.d(9): Error: function diag8714.foo circular dependency. Functions cannot be interpreted while being compiled fail133.d:fail_compilation/fail133.d(13): Error: function D main circular dependency. Functions cannot be interpreted while being compiledJust got the error above. Is this fundamental or an implementation artifact? -- Andreifundamental. interpreter operates only on fully semanticed functions, where all the analysis, type inferencing and lowering is already complete (otherwise interpreter have to reimplement *all* the frontend again, to do exactly same work). the error mesage you got means that CTFE tried to execute something that is still in semantic analysis stage. this *may* be somewhat relaxed by doing lazy semantic (i.e. only mark something for "future analysis", and do real thing when interpreter/compiler really need semantic results), but it will require a huge efforts to implement this in current FE architecture. still, this may be some obscure bug in semantic analyser, so it will be good to see a minified sample that triggers this.
Aug 24 2016
On Thursday, 25 August 2016 at 04:39:01 UTC, Walter Bright wrote:From the test suiteyeah, this is it. template instantiation wants semantic, and we are already semanticing the function. while this restriction can be somewhat relaxed, it will require huge amount of hacks, will be PITA to maintain, and adds very little value (i think) in exchange.
Aug 24 2016
p.s. i just thought that Andrei hits this somewhere in his own code, so i asked for a sample.
Aug 24 2016
On 8/24/2016 10:51 PM, ketmar wrote:p.s. i just thought that Andrei hits this somewhere in his own code, so i asked for a sample.It's fine if Andrei produces a sample, and it can be compared with the existing stuff in the test suite to see if it is fundamentally different.
Aug 24 2016
On 08/25/2016 02:10 AM, Walter Bright wrote:On 8/24/2016 10:51 PM, ketmar wrote:It's similar. I got convinced my code was attempting something unreasonable. Thanks! -- Andreip.s. i just thought that Andrei hits this somewhere in his own code, so i asked for a sample.It's fine if Andrei produces a sample, and it can be compared with the existing stuff in the test suite to see if it is fundamentally different.
Aug 25 2016
On 25.08.2016 05:11, ketmar wrote:On Thursday, 25 August 2016 at 02:20:31 UTC, Andrei Alexandrescu wrote:(The remainder of the post is describing implementation details; this doesn't explain why the limitation is fundamental.)Just got the error above. Is this fundamental or an implementation artifact? -- Andreifundamental.interpreter operates only on fully semanticed functions, where all the analysis, type inferencing and lowering is already complete (otherwise interpreter have to reimplement *all* the frontend again, to do exactly same work). ...Usually, to do exactly the same work, one would just use exactly the same code.the error mesage you got means that CTFE tried to execute something that is still in semantic analysis stage.No, it means CTFE tried to execute a function of which some parts are still in semantic analysis stage. E.g., it is clear what the following function should mean, if it was assigned a meaning: int foo(int x){ if(x==0) return 1; enum r=foo(0); return r; } Usually CTFE only fails if the dynamic branch actually taken runs into a problem, so this is somewhat inconsistent.
Aug 24 2016