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

Mike Kerner MikeKerner at roadrunner.com
Thu Aug 8 17:10:21 EDT 2013


We also had this debate on several bug reports at quality.runrev.com, so
you will find much of this hashed out over there, over several bug
reports.  Excuse me while I wax extemporaneously for a moment.


My fellow LiveCoders, I implore you, to reach within your souls and ask
yourselves, are not all commas created equal?  Is a naked comma on front of
a list somehow more important than the lowly little one on the back?  Are
you so jaded by the unwashed masses of C# hackers trying to convince you
that if your language doesn't have a ++ operator it isn't worthy?  No!  It
is a sophisticated, verbose, beautiful and easy-to-read language that will
not allow such abominations as "this me" to exist without a fight.  It is a
language that has survived almost thirty years and has maintained that
pure, amazing quality that is lacking from almost every other language that
has evolved over that time - it is not a write-only language.  It wants to
be read.  it wants to be updated and modernized.  It doesn't require
anywhere near the number of comments or hacks or tweaks, because so much of
it is self-explanatory.

In light of that, I say to you that it is a language that should not count
an empty item on the front of a list while ignoring the one in the back.
We are not those people.  We are better than that.  We are not so steeped
in tradition and the foibles of those who came before us that we leave them
alone like they are sacred, because the code they wrote on their
black-and-white Mac Pluses, when HyperCard came on a stack of 3-1/2" disks,
is somehow more important than the code we write now.

If someone brand new comes to this list - someone who has never used
LiveCode, or Runtime Revolution, or SuperCard, or HyperCard or any of the
other children or grandchildren of Bill Adkinson - if someone brand new,
who does not value legacy over sanctimony comes to this list, and you
explain to them what a container is, what empty is, what an itemDelimiter
is, and how these tools laugh in the face of type declarations, and show
them ",a", and ask them "How many items does that string contain?", what
would they say?  If after they answer, and you show them "a," and ask them
the same question, what would they answer then?

Why is it that we treat the items in our lists like they are schleps in a
queue to throw down their hard-earned Benjamins for a Taylor Swift
concert?  Do we not believe in equality?  Do we really believe that "a,"
and ",a" are different?  No.  Today I say to you that every item was
created equal - even the last one.  Our past is imperfect, but our future
can be.  Why is it that an empty item anywhere in a list matters, unless it
is at the end?  It does matter.  It is significant.  It must be counted.

For my part, I frequently run into this issue when I am working with
databases and LiveCode.  "SELECT name, address1, address2" is one example
where the developer is begging for trouble, because the last item may very
well be empty, and therefore not worthy of counting.  Yet that is not
nearly as horrible as what would happen if I were to INSERT or UPDATE using
a list, either from a dataGrid or a container.  The errors returned are an
open sore that remind you that not all items are created equal.  Not all
items are significant.  Not all items deserved to be counted.

If we are to continue with this deep, age-old injustice, then I say to you
that the Scots must fix every other command that might somehow be affected
by a blank lasty, and ensure that we are not reminded that trailing blank
items even exist.  The database functions, when faced with "SELECT name,
address1, address2" should return an extra comma on the end of the results
when address2 is blank, because even though they do not want to face an
empty last item, I must be on the watch for them, lest the "INSERT" that
follows breaks my app and leaves me to gnash my teeth on the bitter taste
of being so close, and yet so far.


So, in closing, I simply ask you to say it with me now:

"Every comma is significant, even the last one."


On Thu, Aug 8, 2013 at 3:54 PM, <dunbarx at aol.com> wrote:

> 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
>
>
> _______________________________________________
> 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
>



-- 
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."



More information about the use-livecode mailing list