Re: Resurection of routine_id forward referencing
- Posted by Matt Lewis <matthewwalkerlewis at gmail.com> Sep 20, 2006
- 679 views
Kat wrote: > > > > > Euphoria is designed to be interpreted from top to bottom. Any given > > line of code may only reference code above it, not below. That is > > simply how Euphoria operates. Top-to-bottom. If a line of code can > > reference code below it, then this goes against how Euphoria operates. > > That is why Rob considered it a bug and chose to not allow it. > > > > If the current Euphoria code functionality doesn't comply with how you > > code, then perhaps Euphoria isn't for you. It makes one pass over the > > code and begins executing it from the beginning and stops at the > > bottom. > > The interpreter can still make only one pass thru before execution, > and have forward referencing. I've suggested how to do this before: > if it's not resolved as a backwards reference, place it in a que, then > at the end attempt to resolve the que, when done resolving, dump > the que to the .err file. For true forward referencing, you're correct. To get routine_id() to use forward referencing is even more simple. routine_id() resolves the routine id at run time. Since 2.5, run time comes after compile time, so the interpreter has already parsed everything. This is why Rob had to cripple routine_id() to get the same behavior out of it. I think the already-existing loophole of routine_id() is all the excuse that's needed to justify allowing routine_id() to forward reference. Matt Lewis