On 1/28/19 4:03 PM, Michele wrote:
Dear jwe,
I attach the resulting diary.
Thanks. Unfortunately, those tests may not have been the right ones to
run to answer my questions. I'm trying to figure out when eval will
parse something like
eval ("foo -opt")
as an expression (subtract the value of opt from foo) or as a command
(call the function foo with the character string argument "-opt"). It
seems as though eval may never evaluate its argument as a command-style
function call if it is called with an output value:
val = eval ("foo -opt")
Is that correct? I suppose this would be similar to writing
val = foo -opt
in which case the "foo -opt" part is not recognized as a command-style
function call because that can only happen at the beginning of an
expression.
Also the idea of the test like this:
function f (foo)
eval ("foo -opt")
end
f ()
f (1)
was to determine whether the mere existence of a symbol was sufficient
for eval to treat this as a subtraction or is it necessary for the
function parameter "foo" to be defined?
Also, is this different without the eval? What happens for something like
function f (foo)
foo -opt
end
Is this always handled as a subtraction or does it depend on whether f
is called with an argument?
In both cases, I'm assuming the function "foo" exists.
I'll try to come up with another set of tests.
jwe