Re: [Pharo-users] Creating ArrayedCollections
what do you want to do? what is the example? Stef
I'm subclassing ArrayedCollection while coding the examples from A Mentoring Course in Smalltalk, but I can't figure out how to create one!
ClassBasedCharacterArray is a subclass of ArrayedCollection ClassBasedCharacterArray newFrom: 'a string' -> error: ClassBasedCharacterArray cannot have variable sized instances. Huh?
Behavior class>>new: calls Behavior class>>basicNew: which calls Behavior class>>isVariable which returns false.
How does string get around this to create instances? I DebugIt-ed 'a string', but couldn't follow it in the debugger for some reason.
Thanks. Sean -- View this message in context: http://forum.world.st/Creating-ArrayedCollections-tp2714552p2714552.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
_______________________________________________ Pharo-users mailing list Pharo-users@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
Stéphane Ducasse wrote:
what do you want to do? what is the example?
I want to write 'a string' asCondensedCharacterArray where CondensedCharacterArray is a subclass of ClassBasedCharacterArray which is a subclass of ArrayedCollection. In the book, it inherits from CharacterArray, which was the parent class of String in his system. His implementation was: CharacterArray>>asCondensedClassBasedCharacterArray | answer | answer := CondensedClassBasedCharacterArray new: self size. 1 to: self size do: [ :each | answer at: each put: (self at: each) asCondensedClassBasedCharacter ]. ^ answer. But when I put this in ArrayedCollection, I get the error I mentioned. Sean -- View this message in context: http://forum.world.st/Creating-ArrayedCollections-tp2714552p2714625.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
participants (2)
-
Sean P. DeNigris -
Stéphane Ducasse