Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Bug of function error?

 [1/6] from: rotenca::telvia::it at: 22-Jul-2002 12:42


Can someone explain this to me? a: "a" ; == "a" b: tail a ;== "" remove a;== "" a ;== "" b ;== ** Script Error: Out of range or past end try [b] ;== ** Script Error: Out of range or past end ;until here all is OK, but then: error? try [b] ; == false Is it an error? bug? --- Ciao Romano

 [2/6] from: greggirwin:mindspring at: 22-Jul-2002 10:01


Hi Romano, I guess it depends on how you expect things to work. A series stores something like a pointer to the head of the series, and an index into it, right? So, when you remove an element, any other references to that series will have their indexes offset by one from where they were originally. I.e. the series "shrinks" underneath them, but they keep referring to the same index, not the same element, as they were before.
>> a: "ab"
== "ab"
>> b: back tail a
== "b"
>> remove a
== "b"
>> b
== "" --Gregg

 [3/6] from: lmecir:mbox:vol:cz at: 22-Jul-2002 19:29


Hi Romano, funny. It looks, that the error is detected when a string becomes a result: type? try [b] ; == string! b 1 ; == 1 Ciao -L I think, that this kind of "checking" does not work very reliably. ----- Original Message ----- From: "Romano Paolo Tenca" Can someone explain this to me? a: "a" ; == "a" b: tail a ;== "" remove a;== "" a ;== "" b ;== ** Script Error: Out of range or past end try [b] ;== ** Script Error: Out of range or past end ;until here all is OK, but then: error? try [b] ; == false Is it an error? bug? --- Ciao Romano

 [4/6] from: anton:lexicon at: 23-Jul-2002 3:18


Gregg, you need to read Romano's original post a bit more carefully. It seems to me to be a bug of the function 'error? It is a problem because some code may run, causing an error which cannot be handled properly by our usual error-trapping code. Anton.

 [5/6] from: greggirwin:mindspring at: 22-Jul-2002 11:59


Hi Anton, << Gregg, you need to read Romano's original post a bit more carefully...>> Ahhh, yes. That's what I get for doing mail on my first cup of coffee. :) --Gregg

 [6/6] from: rotenca:telvia:it at: 22-Jul-2002 21:35


Hi Ladislav, This confirm my idea that this kind of strings should not trig an error, but should be "reset" by Rebol to the new tail.
> funny. It looks, that the error is detected when a string becomes a result:
I agree, neither doing it, trigs an error.
> b 1 ; == 1
:-) --- Ciao Romano