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

Richard Gaskin ambassador at fourthworld.com
Sun Aug 11 22:19:23 EDT 2013


Mark Wieder wrote:

 > Richard-
 >
 > Sunday, August 11, 2013, 6:22:47 PM, you wrote:
 >
 >> x|x|x -- this contains three items
 >> x|x|x| -- this contains three items
 >
 > unless, of course, the trailing space is considered part of the
 > string, in which case that last line has four items.
 >
 >> x|x|x|x  -- this contains four items

Right, which is why I also included this note:

     ...what we're counting is any chunk that's terminated,
     either by the delimiter or by simply being the end of
     the string...

This also answers the question of deleting elements from terminated 
strings, since the end of a string is a de facto terminator (there 
simply ain't no more).

So the current engine behavior with deleted items would seem both 
consistent with Jacque's definition and arguably rather efficient by 
removing the unneeded explicit terminator at the end of the string.


 >> One simple solution would be to add "lineTerminator" and
 >> "itemTerminator" as synonyms for "lineDelimiter" and "itemDelimiter"
 >> respectively, and then the conceptual model fits what the engine
 >> does. We leave the "*delimter" tokens in place for us ol' timers,
 >> but emphasize "*terminator" for newcomers.
 >
 > That's an interesting idea, but in that case I'd suggest that the new
 > terms "lineTerminator" and "itemTerminator" do the right thing and
 > just leave the *delimiter terms to atrophy away.

Exactly.  I was just being kind to the ol' timers. :)

--
  Richard Gaskin
  Fourth World
  LiveCode training and consulting: http://www.fourthworld.com
  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
  Follow me on Twitter:  http://twitter.com/FourthWorldSys





More information about the use-livecode mailing list