Collect on IdentitySet

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

Collect on IdentitySet

kurs.jan
Hey All,

The collect: on IdentitySet returns Set. Is this really wanted behaviour or is it a bug?

For example:

set := IdentitySet with: 'foo' with: 'bar'.
newSet := set collect: [:e | #size -> e size   ].

This two assertions do not pass:
self assert: newSet size == 2.
self assert: newSet class == IdentitySet

Surprisingly (for me), if I change the implementation of collect: to use
self species new instead of: Set new, the Pharo becomes really unresponsive...

Cheers, Jan
Reply | Threaded
Open this post in threaded view
|

Re: Collect on IdentitySet

Nicolai Hess


2015-07-20 22:11 GMT+02:00 Jan Kurš <[hidden email]>:
Hey All,

The collect: on IdentitySet returns Set. Is this really wanted behaviour or is it a bug?


There was a long discussion about this
http://forum.world.st/IdentitySet-collect-tp4792384.html
and I thought this was fixed
issue 14535


 

For example:

set := IdentitySet with: 'foo' with: 'bar'.
newSet := set collect: [:e | #size -> e size   ].

This two assertions do not pass:
self assert: newSet size == 2.
self assert: newSet class == IdentitySet

Surprisingly (for me), if I change the implementation of collect: to use
self species new instead of: Set new, the Pharo becomes really unresponsive...

Cheers, Jan

Reply | Threaded
Open this post in threaded view
|

Re: Collect on IdentitySet

Marcus Denker-4

On 20 Jul 2015, at 22:42, Nicolai Hess <[hidden email]> wrote:



2015-07-20 22:11 GMT+02:00 Jan Kurš <[hidden email]>:
Hey All,

The collect: on IdentitySet returns Set. Is this really wanted behaviour or is it a bug?


There was a long discussion about this
http://forum.world.st/IdentitySet-collect-tp4792384.html
and I thought this was fixed
issue 14535


I guess only in Pharo5. We can back port if someone takes the lead.

Marcus
Reply | Threaded
Open this post in threaded view
|

Re: Collect on IdentitySet

kurs.jan
Oh, I can confirm, the behaviour in Pharo5 is OK. In Pharo4, as I described. It is not a big deal for me, I just wanted to ask about it...

Cheers,
Jan

On Tue, Jul 21, 2015 at 7:59 AM Marcus Denker <[hidden email]> wrote:

On 20 Jul 2015, at 22:42, Nicolai Hess <[hidden email]> wrote:



2015-07-20 22:11 GMT+02:00 Jan Kurš <[hidden email]>:
Hey All,

The collect: on IdentitySet returns Set. Is this really wanted behaviour or is it a bug?


There was a long discussion about this
http://forum.world.st/IdentitySet-collect-tp4792384.html
and I thought this was fixed
issue 14535


I guess only in Pharo5. We can back port if someone takes the lead.

Marcus