[Top][All Lists]

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

Re: Questions about eval

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

On 1/29/19 4:19 PM, Andrew Janke wrote:

IIRC, the error happens at parse time, and eval balks at evaluating that code, giving you some sort of syntax error before any of it is evaluated.


Since assignment in Octave does produce a value, I think we would want to continue allowing

  x = eval ('y = 1')

to also assign a value to X.

I thought that Octave allowed both of the following

  x = eval ('y = 1; z = 2;')

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

to perform the evaluations, but I see that neither of these work in current Octave and they also fail at when parsing. So I guess compatibility here is already reasonably good.

My question about what to do for

  eval (try_code, catch_code)

remains. Does anyone have comments about that? If not, I can open a bug report so that the issue is not forgotten.


reply via email to

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