opensubscriber
   Find in this group all groups
 
Unknown more information…

x : xtalks@yahoogroups.com 8 January 2005 • 8:47AM -0500

Re: [xTalks] virtual strings (was Are arrays core?)
by Doug Simons

REPLY TO AUTHOR
 
REPLY TO GROUP






On Jan 7, 2005, at 3:31 PM, Dar Scott wrote:
>
> On Jan 7, 2005, at 2:37 PM, Doug Simons wrote:
>
>> I focused on the
>> fundamental principle that "any value can be viewed as a string",
>> which
>> it can be. But there are still times when it makes a difference what
>> internal format a value is being stored in. I guess nothing is
>> perfect!
>
> I think there is a way, but it might not be worth the cost.
>
> It might mean decimal arithmetic and doing away with numberFormat (or
> using it differently).  If all precision is in the virtual number
> strings then some sort of formatting function is needed, maybe one that
> takes or uses numberFormat.  Where one now has 'a & (x/3)', one would
> need 'a & numeralFormat(x/3)' or be content with lots of digits.
>
> We can probably come up with some axioms of what "any value can be
> viewed as a string" should mean.  One consequence should be that the
> user cannot tell whether the result of arithmetic is a string or not.

It's interesting to consider how this might work, but I think the
current system is pretty well entrenched at this point for most xTalk
languages. My goal along these lines at this stage is to make the
integration of different data types as seamless and "natural feeling"
as I can, while providing as much useful functionality as I can. For
example, SenseTalk now stores dates internally as both a number and
possibly a format, so you can do things like this:

put the long date into dueDate
put dueDate -- shows "Friday, January 7, 2005"
add 45 days to dueDate
put dueDate -- shows "Monday, February 21, 2005" (still in the long
date format)

There is more that could be done with this some day, but this suggests
the kind of thing that is possible by storing more than just a string
internally.

>> Object (property list) properties in SenseTalk can be accessed
>> using several syntaxes. Here's an example from the documentation:
>> put (firstName:”Joseph”, age:50) into joe
>> put property age of joe -- 50
>> put the age of joe -- 50
>> put joeʼs firstName -- Joseph
>> put joe.firstName -- Joseph
>>
>> Since properties are containers, you can also change their value using
>> the same syntaxes:
>> add 1 to joe's age
>> set the lastName of joe to "Peabody"
>
> Cool.
>
> Some folks designs might end up with weird, but acceptable, statements
> like this:
>
>     put the joe of ages

Sure, that's perfectly legal -- one just wonders exactly what the
script is about. :-)

> With nesting, that is less of a problem.  There is little need to do
> that kind of thing.
>
>     put the age of joe of clients
>
> Can you do one of these?
>
>      put "x" into char 3 of item 2 of the friends of joe
>      set char 3 of item 2 of the friends of joe to "x"

Yes, those are all valid.

This script:
set clients.joe.age to 27
put clients
put the age of joe of clients

displays:
(joe:(age:"27"))
27

and this one:
put (friends:"Merry,Pippin,Sam") into Frodo
put "x" into char 3 of item 2 of the friends of Frodo
put Frodo
set char 3 of item 2 of the friends of Frodo to "y"
put Frodo's friends

displays:
(friends:"Merry,Pixpin,Sam")
Merry,Piypin,Sam

(I was getting tired of joe, so I changed it a little bit!)

cheers,

Doug


[Non-text portions of this message have been removed]



To unsubscribe, send e-mail to xTalks-unsubscribe@yaho...
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/xTalks/

<*> To unsubscribe from this group, send an email to:
    xTalks-unsubscribe@yaho...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/


Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.