Handling of final delimter (was Re: "this me"?)
Kay C Lan
lan.kc.macmail at gmail.com
Wed Aug 14 08:03:48 EDT 2013
Thanks for the Link, an excellent discussion.
Marks Waddingham's statement:
If you want to be able to represent a nullable string list of any number of
> empty items from 0
>
is like saying:
If you want to be able to represent a nullable array of any number of empty
keys from 0 ???
If you put empty into an Array, it is no longer an array. IMO once you get
below two items you no longer have a List.
On Wed, Aug 14, 2013 at 11:22 AM, J. Landman Gay
<jacque at hyperactivesw.com>wrote:
> The current behavior appears to be the most sensible and robust.
>
> I'm sorry, I just can't agree, and whilst I'd happily argue a billion
Chinese can be wrong, in this case I think Microsoft, Apple, mySQL, Oracle,
postgreSQL, SQLite and I'm sure a bunch more all think ",2," is a List of 3
data items. Maybe I spend too much time with spreadsheets and dbs.
In the Message Box:
put ",2,3,,,,,,9," into tStore
put "My List = " & tStore & cr into msg
repeat with x = the number of items of tStore down to 1
if (item x of tStore is empty) then
--100 lines of code here
put "item " & x & " is empty" & cr after msg
else
--100 lines of code here
put "item " & x & " is not empty" & cr after msg
end if
--100 lines of code here
put item 1 to -1 of tStore into tStore --Devin's suggestion
end repeat
put "My List = " & tStore after msg
Then change the 9 to empty and run the script again. Notice how all the
intermediate steps give the correct answer, it's only at the end you
discover your List has been mangled.
I just wonder how many man hours have been lost tracking down bugs that are
the result of the unexpected disappearance of list items.
I'll contend that if 26+ yrs ago the HC Engineers decided a List must have
a minimum of 1 delimiter and therefore 2 items, be they empty or not, this
discussion would never have come up, no one would argue, 'hey, I want to
put empty into a bunch of items and have them still be counted as an item
unless the item is the last item in which case I want LC to delete the item
even though there is a command for delete but I didn't use it'.
I very much like Mark Wieder's proposal. I also like how he's debunked
speculation as to imminent failure if empty last items were actually
counted as an item. On the other hand it's pretty easy to prove that LC's
current bipolar treatment of items regularly trips up new users.
More information about the use-livecode
mailing list