guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: translators and scoping rules (was: Re: language translator help)


From: John W. Eaton
Subject: Re: translators and scoping rules (was: Re: language translator help)
Date: Sun, 28 Apr 2002 21:26:22 -0500

On 28-Apr-2002, Marius Vollmer <address@hidden> wrote:

| "John W. Eaton" <address@hidden> writes:
| 
| > [defining new local variables via eval.]
| >
| > OK.  I'm not sure whether this feature is really necessary, but it
| > might also turn out to be a mistake to design the translator in way
| > that makes it impossible.
| 
| Can you statically determine whether a function uses eval in such a
| way?  If so, you can generate efficient code for functions that can
| not define new locals, and use some horrible scheme for functions that
| can.

I'm not sure.  It would be easy to determine whether a function uses
eval(), but I think it would be harder to decide whether what funny
stuff might be going on with eval since the string to be evaluated can
come from anywhere, including user input.  If I have something like

  function y = foo (some_string)
    eval (some_string);
    y = sin (x);
  endfunction

and SOME_STRING doesn't define a variable X, it is an error anyway,
and we could probably detect that.  OTOH, there is no way to determine
what might happen for

  function foo (string_one, string_two)
    eval (string_one);
    eval (string_two);
  endfunction

since the code in STRING_TWO might depend on what variables were
defined in STRING_ONE.

Does it matter?  I don't know.  I don't think I would ever write a
program that does these kinds of things, but it is allowed by Matlab,
and Octave users like the fact that Octave has until now tried to be
mostly compatible.  Before I do a lot of coding, I'm trying to explore
what can be done easily if I decide to have Octave emit Scheme code
for Guile to interpret.

jwe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]