Backwards compatibility or sanity? help
Richard Gaskin
ambassador at fourthworld.com
Sat Aug 20 18:47:32 EDT 2016
Monte Goulding wrote:
> The team is in a quandary about the following bug:
>
> http://quality.livecode.com/show_bug.cgi?id=18145
>
> The issue is in LiveCode 6.7 and below `is among` was essentially
> implemented incorrectly meaning that you could get results like this:
>
> put the number of items in "test,this," & comma & \
> (empty is among the items of "test,this,")
> —> 2,true
>
> In LiveCode 7 this (fairly odd) behavior was broken and fixed in the
> early dp releases then broken again when another fix was made. The
> difficulty is trailing delimiters are ignored by all the other things
> like repeat etc.
>
> So the situation at the moment in LiveCode 8 is:
>
> put the number of items in "test,this," & comma & \
> (empty is among the items of "test,this,")
> —> 2,false
>
> Note that in all versions:
>
> repeat for each item tItem in "test,this,”
> — iterates twice with “test” then “this"
> end repeat
> — here tItem is “this"
>
> It’s important to note that this is only an issue if the last item is
> empty and meant to be an empty item.
>
> I personally would rather not revert to the anomalous behavior of `is
> among` as I think it is doing the platform and users a disservice to
> persist in maintaining it.
>
> I’m interested in your thoughts!
We've had numerous lengthy (and sometimes heated) discussions about
whether a string ending in a delimiter is considered have a thing after
that delimiter.
Most often this comes up with item/line counting, e.g.:
the number of items of "test,this,"
Current that returns 2.
I believe the last time this was discussed Mark had explained why a
string ending with a delimiter means there is no item beyond that
delimiter. IIRC it boils down to the delimiter being the end of a
thing, but not a separator between things.
Given that, we would expect this:
(empty is among the items of "test,this,")
...to be false, while this:
(empty is among the items of "test,,this")
...would return true.
The current behavior for Trevor's test is consistent with item counts.
If we change it we open up that can of worms about delimiters all over
again, and undo Mark's thinking on this.
--
Richard Gaskin
Fourth World Systems
Software Design and Development for the Desktop, Mobile, and the Web
____________________________________________________________________
Ambassador at FourthWorld.com http://www.FourthWorld.com
More information about the use-livecode
mailing list