octave-maintainers
[Top][All Lists]
Advanced

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

Re: changing the way script files are evaluated


From: Andreas Romeyke
Subject: Re: changing the way script files are evaluated
Date: Wed, 16 Apr 2008 08:01:04 +0200

Hi John,

Am Tue, 15 Apr 2008 22:42:23 -0400
schrieb "John W. Eaton" <address@hidden>:

> When I started working on modifying the lexer and parser to accept
> block comments I realized that some cleanup was probably needed before

Thanks, that would improve Octave to detect possible errors earlier...


> block comments could really be handled properly.  This work devolved
> into modifying the parser and evaluator so that script files are
> parsed completely and then executed instead of being parsed and
> executed one statement at a time.

But I thought Octave was still using the 'parse all first, then
interprete'-approach.


>   3. Instead of inserting the functions defined in a script in the
>      symbol table when the script is parsed, store a pointer to the
>      function definition in the parse tree for the script, then insert
>      it in the symbol table when the script is evaluated (if
>      necessary).  This solution seems a bit complex, but offers a way
>      to get some increase in efficiency for scripts while still
>      allowing functions to be defined, and "clear all" to work as
>      before.

> I guess 3 is best?  Comments?  Other suggestions?

I think, in case of compatibility 3 will be the best. But otherwise the
major reason to use 'clear_all' is to  clean up previously used
functions and variables. But this means we would have some smelling
code in our scripts. Therefore in case of software quality I would
suggest to use option 2: 

>  1. Do nothing; if you clear everything before running a script that
>     defines and uses functions, you deserve to lose.
>
>  2. Same as 1, but warn about clearing functions from a script that
>     defines them.

Bye Andreas

-- 
Software Developer / Dipl. Inform. (FH)
Max Planck Institute for Human Cognitive and Brain Sciences
Department of Psychology
Stephanstr. 1a, 04103 Leipzig, Germany

Attachment: signature.asc
Description: PGP signature


reply via email to

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