Re: buggy 4.0 program
- Posted by kinz Dec 12, 2008
- 1619 views
Igor, please let me explain why the v3 message is different to the v4 message.
In v3, when a reference to an identifier was found, it checked that the identifier had already been declared. If it hasn't it issued the message saying that 'a' had not been declared.
Ok, "declare then use", old good familiar safe simple reliable scheme.
v4 has a different approach. In v4, an identifier not is discovered missing until all the program has been parsed.
Ok, why not? But my buggy b.e program is complete, all, so to say.
There is nothing to parse any more, I do not include libs. My program
is complete but just buggy. And similar buggy 'a' we may meet in some big program too,
as typo etc etc.
Euphoria is a single pass parser, so at the time, we cannot know what will come next, or how long it will go on. Forward references are now legal, and will ultimately make coding easier. For example, if you include something in your program, you will no longer have to worry about them both including each other, requiring reorganization of code, or lots of routine ids.
Matt, Euphoria is a two pass system (2.5 and up) - it parses and compiles into IL on the first pass, and then it runs the IL code on the second pass.
Now it seems to be parsing to the end of code and it doesn't stop on the first error.
Why do you say that we cannot know what will come next, or how long it will go on?
After the parse\compile pass, the first pass, we have the entire picture of code and all compile time bugs - undeclared names, unresolved conflicts, syntax errors etc.
If there is no a bug in the source code, IL code runs. If there is something wrong in the source code, we have all data to point properly to all wrong places exactly.
No?
Also, the parser itself seems to be two pass now - ifdefs and then code itself.
A nice side effect of forward referencing is that we can report all your typos at one go, so that you can fix them all at once, without the cycle of run-fix-run-...
Matt, there seems to be a contradiction in your words, you say "we cannot know" above, and now, you say "we can report".
Instead, it assumes that a reference to an unknown identifier is valid
and continues with the parsing effort.
Why does it "think", so to say, that I'm going to use or already using the forward
referencing? I do not need the forward referencing at all, for now, maybe.
Forward referencing is a part of the language. So it thinks that you may be trying to use a forward reference the same way that a square bracket tells it that you're doing a subscript operation. If you use the standard library, then you likely are using forward referencing. There are several places where this made the libraries cleaner and easier to maintain.
Maybe, but I do not like forward reference, same as goto, sorry, and probably will not use them both in my progs, probably never.
My 10 years old habit declare then use is strong and very useful for my health, thanks to Rob
I'll address the rest of the post in a separate message...
Ok, I'll read it.
Regards,
Igor Kachan
kinz@peterlink.ru