On Mon, 22 May 2000, Jacqueline Landman Gay wrote:

> Steven D'Aprano wrote:
> 
> > The value of a string being the same string pretty much defeats the
> > purpose of having a value function. Why do you need a function that does
> > nothing?
> 
> I use this capability in HyperCard to quickly extract data from within
> quoted strings in database exports. I usually don't want quoted literals
> to be evaluated. If the quoted string contains commas or other item
> delimiters, then it isn't always possible to use the "replace" function
> to strip off the commas without screwing up the number of items in the
> data. The "value" function, on the other hand, works very well for this
> (or it does in HyperCard anyway.)
> 
> Suppose one record of my exported data looks like this:
> 
>     "Jacque","Gay","President, HyperActive Software"
> 
> In HyperCard, the value of the last item of the line above is equal to
> its string literal, i.e., "President, HyperActive Software". In MC, I
> get a fairly random string returned.

Umm, I think this is wrong: HyperCard doesn't pay attention to quotes
in item chunks.  It only does this for word chunks.

> > 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.
  Regards,
    Scott

> -- 
> Jacqueline Landman Gay        |             [EMAIL PROTECTED]
> HyperActive Software          |                   [EMAIL PROTECTED]
> Custom hypermedia solutions   |         http://www.hyperactivesw.com
> 612.724.1596                  |                   612.724.1562 - fax

********************************************************
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