Problem with OrderedCollection

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with OrderedCollection

Miguel Enrique Cobá Martínez
Maybe is a stupid question, but my tests are failing because this.

This is the code. Paste it in a Workspace:

| t |
"Printing or inspecting this gives OrderedCollection"
t := OrderedCollection new.
t add: ('text', 1 printString).
t class.

"But printing or inspecting this gives a ByteArray"
t := OrderedCollection new
        add: ('text', 1 printString).
t class.

Can someone explain what it is happening?

Thanks,
Miguel Cobá


Reply | Threaded
Open this post in threaded view
|

Re: Problem with OrderedCollection

timrowledge

On 5-Feb-08, at 4:19 PM, Miguel Enrique Cobá Martínez wrote:
>
>
> "But printing or inspecting this gives a ByteArray"
> t := OrderedCollection new
> add: ('text', 1 printString).
> t class.
#add: returns the thing you added, not the thing you added to. So in  
this case, the string.

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Eagles may soar, but weasels aren't sucked into jet engines.



Reply | Threaded
Open this post in threaded view
|

Re: Problem with OrderedCollection

Miguel Enrique Cobá Martínez
tim Rowledge wrote:

>
> On 5-Feb-08, at 4:19 PM, Miguel Enrique Cobá Martínez wrote:
>>
>>
>> "But printing or inspecting this gives a ByteArray"
>> t := OrderedCollection new
>>     add: ('text', 1 printString).
>> t class.
> #add: returns the thing you added, not the thing you added to. So in
> this case, the string.
>

Oh, thanks, so I must send yourself as the last message.

> tim
> --
> tim Rowledge; [hidden email]; http://www.rowledge.org/tim
> Eagles may soar, but weasels aren't sucked into jet engines.
>
>
>
>