Re: Resurection of routine_id forward referencing

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Wed, 20 Sep 2006 13:54:58 -0700, Matt Lewis
<guest at RapidEuphoria.com> wrote:

>Kat wrote:
>> 
>> 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.

I have done this but you should be aware it is not without problems:
http://palacebuilders.pwp.blueyonder.co.uk/pfeat.htm#forwardrefs

In particular there is a real "gotcha" with constants defined in what
I have called "The Danger Zone". Mostly the problems vanish if the
last line of the application is main() or WinMain(), but I think this
sort of thing is the reason why Rob has the philosophy he does and I
can easily imagine a newbie being, well outraged I think is the word
by this behaviour ("IT'S A ****ING CONSTANT!!!!").

There is a genuine fundamental problem here that cannot be solved by
adding more passes to the compiler - the only thing I can think of is
attaching a block of init code to each variable which is run if/when
it is referenced when still uninitialised, and I don't think I want to
go there.

Regards,
Pete

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu