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

Mark Wieder mwieder at ahsoftware.net
Sun Aug 11 22:04:42 EDT 2013


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

The problem becomes more apparent when you think of file paths:

set the itemDelimiter to "/"
put the effective filename of this stack into tPath
delete item -1 of tPath

now if the delimiter char were really a terminator, it should remain
with tPath. But it doesn't. So

put "myFilename" after item -1 of tPath -- needs a terminator prefix:
put "/myFilename" after tPath

similarly,

put "myFilename" after tPath -- needs a terminator prefix

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

-- 
-Mark Wieder
 mwieder at ahsoftware.net





More information about the use-livecode mailing list