Re: The "value"

2000-05-22 Thread Scott Raney

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.




Re: The "value"

2000-05-22 Thread Richard Gaskin

On 5/22/00 3:24 PM, Jacqueline Landman Gay at [EMAIL PROTECTED]
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.
> 
>> 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.

Yes, that is the de facto standard way of handling this in xTalk, including
HyperCard, SuperCard, OMO, and, if memory serves, ToolBook and Gain as well.

-- 
 Richard Gaskin 
 Fourth World
 Multimedia Design and Development for Mac, Windows, UNIX, and the Web
 _
 [EMAIL PROTECTED] http://www.FourthWorld.com
 Tel: 323-225-3717   ICQ#60248349Fax: 323-225-0716


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.




Re: The "value"

2000-05-22 Thread Jacqueline Landman Gay

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.

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

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


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.




Re: The "value"

2000-05-22 Thread Raymond E. Griffith

 "Steven D'Aprano" <[EMAIL PROTECTED]> reasonably corrected my view
thusly: 

I wrote:

>> I think you may have hit upon a bug.

Steven replied: 

> I don't think so. That seems like expected behaviour to me.
> 
>> I put the following into the message box:
>> 
>> answer value("This is my dog.")
>> 
>> and it returned a "double binary operator" and flagged the
>> word "is" as a bad token. Evidently it was trying to evaluate
>> the trueness or falseness of the expression containing "is".
> 
> Well, the error message is a little less than user friendly, but value
> attempts to evaluate its arguments as a Metacard expression. So of
> course it tries to compare "This" with "my dog".
> 
> I'm not sure why it fails instead of returning false. I suspect it may
> have something to do with missing quotes around each substring.
> 
>> However, you would think that the value of a
>> string would be the string.
> 
> Then what is value("1+1")? Should it be the string "1+1"? Or the
> expected result of 2?
> 
> 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?
> 
> Think of value() as stripping a single pair of quotes from a string and
> treating the result as a Metacard expression. Then:
> 
> value(quote & "green_eggs and ham" & quote)
> 
> will return the string "green_eggs and ham", but
> 
> value("green_eggs and ham")
> 
> will attempt to evaluate the variable green_eggs and do a Boolean AND
> with the variable ham.
> 
> Why say
> 
> answer value("3 = 2+1")
> 
> when all you really need is
> 
> answer "3 = 2+1"
> 
> ?
Stephen, you are right. Sometimes it is hard for us hypercarders to make the
switch. MetaCard has so much more power in so many areas, but it takes time
to get used to the new models. I had a horrible time with backgrounds and
groups for about two weeks because I didn't completely understand the new
model. Now I see MC's model as superior, and love it -- though there are a
few unintended consequences now and again as models get mixed (wry
grin).

Value is one of the HC statements that gets used for strings because HC
doesn't have some of MC's features.

Thanks for the help.

Raymond 
> -- 
> Steven D'Aprano


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.




Re: save or save as...

2000-05-22 Thread Isotalo

Hi James,

To make a standalone choose "Tools, standalone builder".

Regards,
Eva


James Kelly wrote:

> Hi all
> I'm new to metacard and I am scratching my head over something. Say I
> want to create a freestanding stack, with the starter kitt. Say I want
> to send it to someone that dosn't have metacard. How do I create a
> freestanding stack...save or save as?
>
> Jim Kelly
>
> 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.


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.




Re: The "value"

2000-05-22 Thread Steven D'Aprano

Raymond E. Griffith wrote:

> I think you may have hit upon a bug.

I don't think so. That seems like expected behaviour to me.

> I put the following into the message box:
> 
> answer value("This is my dog.")
> 
> and it returned a "double binary operator" and flagged the 
> word "is" as a bad token. Evidently it was trying to evaluate 
> the trueness or falseness of the expression containing "is". 

Well, the error message is a little less than user friendly, but value
attempts to evaluate its arguments as a Metacard expression. So of
course it tries to compare "This" with "my dog".

I'm not sure why it fails instead of returning false. I suspect it may
have something to do with missing quotes around each substring.

> However, you would think that the value of a
> string would be the string.

Then what is value("1+1")? Should it be the string "1+1"? Or the
expected result of 2?

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?

> However, I tried
> 
> answer value(quote & "This is my dog." & quote)
> 
> and it returned
> 
> This is my dog.

Sounds right to me.

Think of value() as stripping a single pair of quotes from a string and
treating the result as a Metacard expression. Then:

value(quote & "green_eggs and ham" & quote)

will return the string "green_eggs and ham", but 

value("green_eggs and ham")

will attempt to evaluate the variable green_eggs and do a Boolean AND
with the variable ham.

> I admit I like HC's easy way of handling strings. However, 
> even it is a bit arbitrary. For example, in HC
> 
> answer value(3 = 2+1)
> 
> and 
> 
> answer value("3 = 2+1")
> 
> both return 
> 
> true
> 
> even though I hoped to get a string back for the second. 

Why say

answer value("3 = 2+1")

when all you really need is

answer "3 = 2+1"

?


-- 
Steven D'Aprano

==
M.B. Sales Pty LtdPh:  +61 3 9460-5244
A.C.N. 005-964-796Fax: +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.