Scott Raney wrote:
> > > Then what is value("1+1")? Should it be the string "1+1"? Or the
> > > expected result of 2?
> >
> > I'd say if it were in quotes, it should be treated as a string
> > literal and the value should be "1+1". If it isn't in quotes,
> > the value should be 2.
>
> This is exactly the way MetaCard works. What it doesn't do currently
> is pass back the entire string if the evaluation of it as an
> expression fails. This will be easy to change to improve
> compatibility, but is really an abuse of the value() function, which
> even in the HyperCard documentation is specified to work on
> *expressions*, not arbitrary strings of characters.
I'm not sure of the correct syntax (something with try and catch?), but
just off the top of my head something like this should work:
function custom_value str
put value(str) into myresult
if an error occurs return str -- this isn't correct syntax
else return myresult
end custom_value
--
Steven D'Aprano
==========================================
M.B. Sales Pty Ltd Ph: +61 3 9460-5244
A.C.N. 005-964-796 Fax: +61 3 9462-1161
Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.