Inconsistent Behavior of Lists
Brian Yennie
briany at qldlearning.com
Wed Sep 15 21:03:27 EDT 2004
Dan,
It appears to me that you're hitting the difference between strings and
lists. The native data type in Rev is a string, and if you want it to
be treated specially because it follows some sort of list syntax,
you'll need to script that behavior. Otherwise you would have the
opposite effect- many people would be alarmed if spaces started
disappearing from their strings any time they followed a certain
pattern. Unfortunately list is not a native type, whereas associative
arrays and strings are.
Generally, this is where split and combine come in handy, plus possibly
some replace and regex to clean things up. Is there a particular task
you have in mind?
If your primary concern is extra whitespace, could you write a simple
trim() function which removes it, and run your item chunking through
that?
I agree with (some) others that it's not a bug, but I could see an
enhancement- maybe something like an "ignoreWhitespace" global property
that could be set, much like the "caseSensitive" property.
- Brian
> A list should be seen as a comma-delimited data container where commas
> separate data elements. Spaces after commas should not be significant.
> They aren't in any other language I know of that processes list data
> structures. a="1",b="2" and a="1", b="2" should be identical. In Rev,
> they are not. Rev sees the first element of the second item as " b",
> which makes no syntactic sense as far as I can tell.
>
> Anyway, it appears nobody else thinks this is a bug so i won't BZ it.
> I'll just grouse.
>
> Dan
More information about the use-livecode
mailing list