Re: routine_id evaluation

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

----- Original Message -----
From: "Robert Craig" <rds at RAPIDEUPHORIA.COM>

> Derek Parnell writes:
> > I don't suppose you'd consider allowing routine_id
> > to be evaluated at run-time rather than at "compile" time?
>
> It *is* evaluated at run-time.
> However, it will only find routines that are defined
> earlier than the place where you call routine_id().

Robert, did you get out of the wrong side of bed this morning. Please don't
play semantic games. You know that I already know how it works now, and you
know perfectly well what it is that I'm asking for!

Of course its currently done at run-time because its an interpreted
language. With an interpreted language, everything is run-time! It seems
that what you are implying is the Euphoria evaluates the parameter during
the syntax checking stage of the interpretation rather than the execution
stage of the interpretation.

If I have a procedure such as ...
  procedure abc()
      q = def(xyz)
  end procedure

I don't expect def() to evaluate its parameter until the abc() procedure is
executing.

but it seems that Euphoria treats routine_id differently than other
functions. In this case ...

  procedure abc()
      q = routine_id(xyz)
  end procedure

it would seem that routine_id() does evaluate its parameter even when abc()
is not being executed.

However, it seems to me that *if* Euphoria internally stores the location
and names of all its routines during the initial syntax pass, then at the
time that routine_id() actually executes, it could look up the internal
table and determine when in blazes the referenced routine (in the parameter)
is.

I'd rather that the function's parameter was evaluated at the time that the
routine_id function was executed rather than at the time that the
interpreter finds the refernce to the routine_id function in the code.

In other words, what I'd like is the following pseudo-code behaviour...

   When the interpeter finds a routine_id() in the code,
       if in syntax parsing state (or whatever you call it)
            tokenize the function call and its parameter
       elsif in executing state (or whatever you call it)
            if the parameter has not been resolved yet
                look up the name of the routine being referenced
                add to the array of internal routine_ids
                store the resolved reference if found (-1 otherwise)
            else
                get the location of the routine from the internal
routine_ids table
            end if
            attempt to call the referenced routine
       end if

------
Derek Parnell
Melbourne, Australia
(Vote [1] The Cheshire Cat for Internet Mascot)

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

Search



Quick Links

User menu

Not signed in.

Misc Menu