Hi,

i'm currently running this expression and wonder why i got a backtrace:

   st> ((ByteStream on: 'foobar') next: 3)!
      Object: Character error: Invalid argument f: must be a SmallInteger
      SystemExceptions.WrongClass(Exception)>>#signal
      SystemExceptions.WrongClass class>>#signalOn:mustBe:
      SystemExceptions.WrongClass class>>#signalOn:mustBe:
      Character class>>#value:
      ByteStream>>#next
      [] in ByteStream(Stream)>>#next:
      BlockClosure>>#on:do:
      ByteStream(Stream)>>#next:
      UndefinedObject>>#executeStatements
      nil

   st> (ByteStream on: 'foobar')!
      ByteStream new "<0x2b782b783740>"

   st> (ByteStream on: 'foobar') next!
      Object: Character error: Invalid argument f: must be a SmallInteger
      SystemExceptions.WrongClass(Exception)>>#signal
      SystemExceptions.WrongClass class>>#signalOn:mustBe:
      SystemExceptions.WrongClass class>>#signalOn:mustBe:
      Character class>>#value:
      ByteStream>>#next
      UndefinedObject>>#executeStatements
      nil

I chased it down and looked in ByteStream>>#next:

   next
       "Return the next *character* in the ByteArray"
       ^Character value: super next

My guess:
As the collection used internally in ByteStream is a String 
(ByteStream>>#species returns that at least)
(super next) returns a Character and not a SmallInteger.

Fix/Workaround might be:

   next
       ^super next

(or just drop it :-)

This is gst 2.2b on a:
Linux elmex2 2.6.17.8 #2 Sun Sep 24 21:31:08 CEST 2006 x86_64 GNU/Linux

cu,
Robin


_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to