Question (more or less) about arrays
Björnke von Gierke
bvg at mac.com
Tue Apr 3 19:58:55 EDT 2007
how should an array behave in an xtalk language? In my opinion it
should try to anticipate the use people would want of it, as well as
behaving the same every time (consistence). With that in mind, I would
let an array accessed trough "put myArray" return the same as when one
would do this:
combine myArray using (the linedelimiter) and (the itemdelimiter)
put myArray
split myArray using (the linedelimiter) and (the itemdelimiter)
So an array would basically give it's content, but remain an array.
This of course would allow to get the myCustompropertyset of an object
the same way.
If one want's to test whether something is an array one would need to
do the same as today, namely test whether the keys of myArray is empty.
Maybe an addition to the "is a" for arrays would be nice too? And while
we're at it where are the "is among the keys" and "is among the
elements" tests?
Arrays are fun to improve :)
Björnke
On 03 Apr 2007, at 17:50, Dave wrote:
>
> On 3 Apr 2007, at 16:52, jbv wrote:
>
>>
>>
>> Richard Gaskin a *crit :
>>
>>>>
>>>> One option is to return the same thing as when using "the keys of
>>>> var",
>>>> IOW the list of the keys of the array...
>>>
>>> How would one distinguish between an array and a non-array which
>>> contains any return-delimited list?
>>
>> Well, actually, my problem was to detect if a var was empty or not, no
>> matter if it was an array or a regular variable.
>> At least my proposition solves my original problem.
>>
>> As for your question, may be could there be a command named "the
>> arrayNames"
>> that would list the variables containing arrays ?
>> Therefore we could use some simple test such as :
>> if my var is not empty and my var is among the arrayNames
>>
>> I'm sure someone will come up with a better idea...
>
> Maybe it would be better to just add a "type" function?
>
> e.g. Something like:
>
> if revType(myVar) = "Array" then
> .............................
>
>
> All the Best
> Dave
--
official ChatRev page:
http://chatrev.bjoernke.com
Chat with other RunRev developers:
go stack URL "http://homepage.mac.com/bvg/chatrev1.3.rev"
More information about the use-livecode
mailing list