On Wed, 24 May 2000, Jeanne A. E. DeVoto wrote:

> At 5:10 AM -0700 5/23/2000, Scott Raney <[EMAIL PROTECTED]> wrote:
> >On Mon, 22 May 2000, Jacqueline Landman Gay 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.
> 
> A string considered as an arbitrary string of characters *is* an
> expression, though, albeit the simplest type of expression, one that
> consists of a single factor. String is a data type, after all, and that
> makes
>   "This is a string"
> as much an expression as
>   true
> or
>   17
> Even if you don't try to go inside the quotes to evaluate its content.

A quoted string definitely is an expression, but an *unquoted* string,
which is what Jacque was trying to use, is not.  An expression is
composed of factors (single words) connected together with operators,
and the space character is not an operator.

Just for the curious, the comma is an operator in MetaTalk but not in
HyperTalk.  This is to allow for things like:
set the backgroundColor of button 1 to 255,0,0  -- RGB for "red"

This would work in HyperCard too (at least, if it supported color ;-)
but only because HyperCard takes everything from the last thing it can
parse in a command to the end of a line as one parameter.  This is a
hack, is not documented (indeed, is not even possible to document in a
standard BNF syntax chart), and is not implemented in MetaTalk.  It's
probably also why the value() function works the way it does in
HyperCard.

> I think you can make a case, conceptually, for the value function doing one
> more round of parsing on a string literal. But you can make just as good a
> case for treating a quoted string as a factor instead - and doing so lets
> you do additional things with the value function. Between that and the
> compatibility argument, I think Jacque has made the case for changing the
> behavior here.

Agreed.  But compatibility should have limits, and I'd say this is
already over that line because it violates even the BNF syntax chart
Apple produced for HyperCard.  Emulating deviations from their own
specs doesn't seem like a feature to me.
  Regards,
    Scott

> --
> jeanne a. e. devoto ~ [EMAIL PROTECTED]
> http://www.jaedworks.com

********************************************************
Scott Raney  [EMAIL PROTECTED]  http://www.metacard.com
MetaCard: You know, there's an easier way to do that...


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.

Reply via email to