Handling of final delimter (was Re: "this me"?)

dunbarx at aol.com dunbarx at aol.com
Thu Aug 8 15:54:57 EDT 2013


I agree with Jacque's construct. I was thrown,long ago, with the number of items, say, in:


"1,2,3,4,"



That last comma should indicate a "placeholder" for a fifth item at the end of the string, but there are in fact only four. One could say that since the last comma precedes "empty". The number of commas is not important, only the number of actual items, empty being much less than zero or blank or anything with even a tinge of real existence.


It cannot even be thought of as a placeholder for some future fifth item. The last comma is real, but as there is no item following, it is simply superfluous.



One would only have to worry about this sort of thing if it was desired to append more items. Then you have to watch out. Appending "5,6,7" is straightforward with the dangling comma. Appending without it is a different string entirely.


Craig




-----Original Message-----
From: J. Landman Gay <jacque at hyperactivesw.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Thu, Aug 8, 2013 3:34 pm
Subject: Re: Handling of final delimter (was Re: "this me"?)


On 8/8/13 12:45 PM, Ben Rubinstein wrote:

> I think the return (or equally the comma when dealing with items)
> doesn't "belong" to the line that it terminates (as I tend to think of
> it) - or indeed to the line that follows it (as perhaps you do); it is,
> indeed just a delimiter.

My mental model is different. I do think of the delimiter as "belonging" 
to the item it delimits. A return character belongs to the line it 
follows. A comma belongs to the item it follows. There is no requirement 
that a final delimiter be present, but if it is, it doesn't change the 
count.

When you think of it that way, it all falls into place.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 



More information about the use-livecode mailing list