Failing to understand the oddities of the "line" chunk

Pete pete at mollysrevenge.com
Tue Mar 20 13:17:53 EDT 2012


I'd like to chime in here again on a couple of things.

First, I'm sticking by my assertion that a range with an end point less
than a start point is not a logical structure in a general sense.  I'm well
aware the the selectedChunk uses that mechanism to indicate the position of
the insertion point when no text is selected.  That makes it valid in LC
terms but it doesn't make it logical.

I can think of several other ways LC could have indicated the position of
the insertion point, for example the selectedChunk could have returned a
single character position instead of a range.  But the original design of
Hypercard or whatever it was back in those days didn't do it that way so
that's what we have.

I'm also against making lines behave in the same way as characters. I know
it's a self supporting statement but I just don;t like the idea of
proliferating an illogical construct for the sake of consistency.  But more
important than that, lines and characters are two entirely different
things.

Lines don't have an insertion point, which seems to be the only reason that
a range with an end point less than a start point is valid in LC.  They
have a terminating character (or separator depending on your point of
view); characters don't have  a separator that delineates them from each
other. If you get the selectedLine, you will see either a single line
number if one line is selected or a line number range if multiple lines are
selected but you will never see a line range with the end line less than
the start line.

So I wouldn't vote for a bug report that asked for lines to behave like
characters in this respect.  I would vote for a bug report that asked for
this situation to be caught as an error (although I think it would have to
be a run time error not compile time since the start and end points could
be variables or expressions).

Lost in this discussion is the reason why someone wanted to do this in the
first place.  Alex, I think it was you that started this whole thread - did
you have a specific reason for wanting to specify a line range with an end
point before the start or was it just an observation?

Pete

On Tue, Mar 20, 2012 at 7:37 AM, Peter M. Brigham, MD <pmbrig at gmail.com>wrote:

> On Mar 20, 2012, at 10:00 AM, Klaus on-rev wrote:
>
> > Hi Peter,
> >
> > Am 20.03.2012 um 14:40 schrieb Peter M. Brigham, MD:
> >
> >> On Mar 20, 2012, at 1:52 AM, Geoff Canyon wrote:
> >>
> >>> On Mon, Mar 19, 2012 at 12:54 PM, J. Landman Gay
> >>> <jacque at hyperactivesw.com>wrote:
> >>>
> >> ...
> >> Jacque's point still holds, though -- the implementation of this form
> using lines instead of chars is *not* consistent.
> >> try this:
> >>
> >> put "one,two,three" into t
> >> replace comma with cr in t
> >> put t into tt
> >
> >> ##put "WHAT!!!???" into line 3 to 2 of tt
> > ## Wrong ORDER of line range!
> >
> > put "Waht!!!???" into line 2 to 3 of tt
> > ## Will give the desired result:
>
> That's my point. The compiler should reject
>    put "WHAT!!!???" into line 3 to 2 of tt
> if it's not going to implement it in a way that is consistent with
>   put "WHAT!!!???" into char 3 to 2 of tt
>
> -- Peter
>
> Peter M. Brigham
> pmbrig at gmail.com
> http://home.comcast.net/~pmbrig
>
>
> _______________________________________________
> 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
>
>


-- 
Pete
Molly's Revenge <http://www.mollysrevenge.com>



More information about the use-livecode mailing list