Re: How compiler detects forward reference errors

2016-09-08 Thread Igor via Digitalmars-d-learn
Thank you all for your replies. I am trying to learn a bit about compiler and language design and I really like D among many other languages I read about so I am trying to learn from it as well.

Re: How compiler detects forward reference errors

2016-09-04 Thread Illuminati via Digitalmars-d-learn
On Sunday, 4 September 2016 at 19:15:15 UTC, Igor wrote: On Saturday, 3 September 2016 at 14:13:27 UTC, Lodovico Giaretta wrote: On Saturday, 3 September 2016 at 14:06:06 UTC, Igor wrote: Can anyone explain in plain English how does compiler process and detect a "test.d(6) Error: forward

Re: How compiler detects forward reference errors

2016-09-04 Thread Lodovico Giaretta via Digitalmars-d-learn
On Sunday, 4 September 2016 at 19:15:15 UTC, Igor wrote: So, you are saying compiler is keeping a kind of linked list of dependencies and then checks if any of those lists are circular? But how exactly would that list be structured since one expression can have multiple dependencies, like:

Re: How compiler detects forward reference errors

2016-09-04 Thread Igor via Digitalmars-d-learn
On Saturday, 3 September 2016 at 14:13:27 UTC, Lodovico Giaretta wrote: On Saturday, 3 September 2016 at 14:06:06 UTC, Igor wrote: Can anyone explain in plain English how does compiler process and detect a "test.d(6) Error: forward reference of variable a" in following code: import

Re: How compiler detects forward reference errors

2016-09-03 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 3 September 2016 at 14:06:06 UTC, Igor wrote: Can anyone explain in plain English how does compiler process and detect a "test.d(6) Error: forward reference of variable a" in following code: Via bugs, it does if(would_be_annoying_to_user) trigger_error(); else let_it_work();

Re: How compiler detects forward reference errors

2016-09-03 Thread Lodovico Giaretta via Digitalmars-d-learn
On Saturday, 3 September 2016 at 14:06:06 UTC, Igor wrote: Can anyone explain in plain English how does compiler process and detect a "test.d(6) Error: forward reference of variable a" in following code: import std.stdio; enum a = 1 + b; enum d = 5 + a; // No error here enum b = 12 + c; enum