Failing to understand the oddities of the "line" chunk

Pete pete at mollysrevenge.com
Tue Mar 20 14:57:02 EDT 2012


I think it's unlikely anything about this behavior will change no matter
what bug report is filed.  There's the backward compatibility issue you
raised (although I personally think that is usually a cop out) but you
could also argue that what happens is by design.

I'm thinking your hope for a "more right" answer is probably in vain at
this point!

Pete

On Tue, Mar 20, 2012 at 10:53 AM, Alex Tweedly <alex at tweedly.net> wrote:

> On 20/03/2012 17:17, Pete wrote:
>
>> 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?
>>
>>  No, no specific reason to want to do it - it kind of happened by
> accident :-)
> And it wasn't so much an observation as a question -
>   can someone give me a rationale for this behaviour so I can deal with it
> better ?
>
> What I *wanted* to do was replace line 'x' of someContainer (and
> everything after it) by my new data,
> so I did the (temptingly logical - but WRONG) thing of
>
>     put newData into line x to -1 of someContainer
>
> NB that is simply wrong, because "line -1" means the last line that is
> there - not to the end after what I specified :-)
>
> as it happened, the container had x-1 lines in it at the time (including a
> trailing line delimiter, just to confuse things), so that became equivalent
> to   "put newData into line x to x-1 of someContainer"
>
> I knew that what was happening seemed wrong - but couldn't figure out how
> or why. Jacque's explanation showed me what I should do - but still left
> that niggling feeling of something being a bit odd.
>
> I can get what I wanted in a couple of safe ways
> a.    delete line x to -1 of t    !! inverted range - but AFAIK it does
> the right thing with it in all cases
>       put newData into line 2 of t
>
> b.    put newData into line 2 to kInfinity of t   -- where kInfinity is
> some arbitrarily large constant
>
> I'm not sure what I would vote for now, hence I haven't yet put in a bug
> report. Personally, I'd probably like a run-time error, but I suspect that
> the need for backwards compatability would prevent that being feasible.
>
> -- Alex, still hoping for someone to come up with a "more right" answer :-)
>
>
>
> ______________________________**_________________
> 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<http://lists.runrev.com/mailman/listinfo/use-livecode>
>
>


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



More information about the use-livecode mailing list