Re: Routine_ID Is No Doubt My Solution...

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

On Sun, 13 Apr 2003 08:30:28 +1000, Derek Parnell
<ddparnell at bigpond.com> wrote:

>Pete's solution is the right thing, but this behaviour of Euphoria is
>designed. RDS explicitly wants Euphoria to be like this - it is NOT
>"over-zealous optimisation". The design philosophy for Euphoria is =
"nothing
>can be referenced until it has been 'seen' by the translator first".

Derek is right again blink  I now fully understand and accept this (but
I'll beat it to death anyway)  eg:

a=3Droutine_id("b")
...
procedure b()

will not work, because when routine_id is executed, b() has not yet
been defined; it is not yet in the symbol table. But:

constant name=3D"b"
procedure a()
	?routine_id(name)		-- line 3
end procedure
procedure b()
end procedure
?routine_id(name)			-- line 7
a()						-- line 8

In this case, line 7 passes the same constant to the same built-in
function as line 3, which is actually executed after line 7, but it
gives a different result(!!). Hence somewhere for line 3 it must be
deliberately storing an index of some sort specifically to force this
behaviour. So Derek is right, this is not an optimisation, in fact it
is an (admittedly insignificant) overhead! And as usual the
documentation is spot-on, I just assumed it was using "after" in an
execution sense rather than a dogmatic absolute line number sense.
 You live and learn.

><soapbox>
>IMHO, this is a dumb decision and one of the most annoying things about =
this
>great language. The lack of forward referencing makes things harder for =
the
>coder. I can understand the excuse for it in the early days when =
computers
>were slow, but with modern computers I really don't mind waiting the one=
 or
>two seconds it takes to parse the whole code before execution.
></soapbox>

Agreed.

Pete

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

Search



Quick Links

User menu

Not signed in.

Misc Menu