octave-maintainers
[Top][All Lists]
Advanced

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

Questions about eval


From: John W. Eaton
Subject: Questions about eval
Date: Tue, 29 Jan 2019 15:53:34 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1

I noticed that Matlab's documentation for eval no longer mentions the form

  eval (try_code, catch_code)

to evaluate the "catch_code" if "try_code" throws an error. Should we also deprecate this feature in Octave?

Does Matlab restrict the code to be evaluated to be a single expression, or are statements and multiple expressions allowed? For example, what happens for the following in current Matlab versions?

  eval ('x = 2+2')

  eval ('1+1, pi')

  eval ('for i = 1:3, i, end')

In Octave, all of these work. If Matlab restricts the argument of eval to be a single expression (not a statement) then should we also impose that limitation? It might simplify the implementation somewhat if we did not have to handle arbitrary code.

Thanks,

jwe




reply via email to

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