help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] question about ByteStream(Stream)>>#next:


From: Robin Redeker
Subject: [Help-smalltalk] question about ByteStream(Stream)>>#next:
Date: Wed, 25 Oct 2006 22:40:01 +0200
User-agent: Mutt/1.5.11+cvs20060403

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]