Missing collectAsSet: in Pharo 3.0
Hi, In Pharo 3 you guys integrated Doruâs CollectionsExtension package, which is great. You forgot, however, to integrate the utility method #collectAsSet: I was using in several places in my code. It should be simply ^ self collect: aBlock as: Set Could someone please put this in the standard image please? Thanks. Cheers, R
Create a ticket Propose a slice Enjoy the process :P Ben On 10 Dec 2013, at 14:21, Roberto Minelli <roberto.minelli@usi.ch> wrote:
Hi,
In Pharo 3 you guys integrated Doruâs CollectionsExtension package, which is great.
You forgot, however, to integrate the utility method #collectAsSet: I was using in several places in my code.
It should be simply ^ self collect: aBlock as: Set
Could someone please put this in the standard image please? Thanks.
Cheers, R
I don't think it has to be in the image, After all, you can just replace your calls for #collect:as: Esteban On Tue, Dec 10, 2013 at 2:21 PM, Roberto Minelli <roberto.minelli@usi.ch>wrote:
Hi,
In Pharo 3 you guys integrated Doruâs CollectionsExtension package, which is great.
You forgot, however, to integrate the utility method #collectAsSet: I was using in several places in my code.
It should be simply ^ self collect: aBlock as: Set
Could someone please put this in the standard image please? Thanks.
Cheers, R
No. Since #flatCollectAsSet: is in the image, #collectAsSet: should be in the image as well. And then, since we want clean code #collectAsSet: is cleaner than #collect:as:. On Dec 10, 2013, at 2:23 PM, Esteban Lorenzano <estebanlm@gmail.com> wrote:
I don't think it has to be in the image,
After all, you can just replace your calls for #collect:as:
Esteban
On Tue, Dec 10, 2013 at 2:21 PM, Roberto Minelli <roberto.minelli@usi.ch> wrote: Hi,
In Pharo 3 you guys integrated Doruâs CollectionsExtension package, which is great.
You forgot, however, to integrate the utility method #collectAsSet: I was using in several places in my code.
It should be simply ^ self collect: aBlock as: Set
Could someone please put this in the standard image please? Thanks.
Cheers, R
On 10 Dec 2013, at 14:26, Roberto Minelli <roberto.minelli@usi.ch> wrote:
No. Since #flatCollectAsSet: is in the image, #collectAsSet: should be in the image as well.
And then, since we want clean code #collectAsSet: is cleaner than #collect:as:.
Yes, but this also means that you need to implement: collectAsArray: collectAsOrderedCollection: collectAsBag: ⦠:)
On Dec 10, 2013, at 2:23 PM, Esteban Lorenzano <estebanlm@gmail.com> wrote:
I don't think it has to be in the image,
After all, you can just replace your calls for #collect:as:
Esteban
On Tue, Dec 10, 2013 at 2:21 PM, Roberto Minelli <roberto.minelli@usi.ch> wrote: Hi,
In Pharo 3 you guys integrated Doruâs CollectionsExtension package, which is great.
You forgot, however, to integrate the utility method #collectAsSet: I was using in several places in my code.
It should be simply ^ self collect: aBlock as: Set
Could someone please put this in the standard image please? Thanks.
Cheers, R
And then rejectAsSet: selectAsHeap: etc... A big -1 2013/12/10 Yuriy Tymchuk <yuriy.tymchuk@me.com>
On 10 Dec 2013, at 14:26, Roberto Minelli <roberto.minelli@usi.ch> wrote:
No. Since #flatCollectAsSet: is in the image, #collectAsSet: should be in the image as well.
And then, since we want clean code #collectAsSet: is cleaner than #collect:as:.
Yes, but this also means that you need to implement:
collectAsArray: collectAsOrderedCollection: collectAsBag: â¦
:)
On Dec 10, 2013, at 2:23 PM, Esteban Lorenzano <estebanlm@gmail.com>
wrote:
I don't think it has to be in the image,
After all, you can just replace your calls for #collect:as:
Esteban
On Tue, Dec 10, 2013 at 2:21 PM, Roberto Minelli <
roberto.minelli@usi.ch> wrote:
Hi,
In Pharo 3 you guys integrated Doruâs CollectionsExtension package, which is great.
You forgot, however, to integrate the utility method #collectAsSet: I was using in several places in my code.
It should be simply ^ self collect: aBlock as: Set
Could someone please put this in the standard image please? Thanks.
Cheers, R
Being consistent does not mean we have to be absolute :) Ben On 10 Dec 2013, at 14:38, Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> wrote:
And then rejectAsSet: selectAsHeap: etc... A big -1
2013/12/10 Yuriy Tymchuk <yuriy.tymchuk@me.com>
On 10 Dec 2013, at 14:26, Roberto Minelli <roberto.minelli@usi.ch> wrote:
No. Since #flatCollectAsSet: is in the image, #collectAsSet: should be in the image as well.
And then, since we want clean code #collectAsSet: is cleaner than #collect:as:.
Yes, but this also means that you need to implement:
collectAsArray: collectAsOrderedCollection: collectAsBag: â¦
:)
On Dec 10, 2013, at 2:23 PM, Esteban Lorenzano <estebanlm@gmail.com> wrote:
I don't think it has to be in the image,
After all, you can just replace your calls for #collect:as:
Esteban
On Tue, Dec 10, 2013 at 2:21 PM, Roberto Minelli <roberto.minelli@usi.ch> wrote: Hi,
In Pharo 3 you guys integrated Doruâs CollectionsExtension package, which is great.
You forgot, however, to integrate the utility method #collectAsSet: I was using in several places in my code.
It should be simply ^ self collect: aBlock as: Set
Could someone please put this in the standard image please? Thanks.
Cheers, R
IMO, if there is an error, then is the presence of #flatCollectAsSet:, not the absence of the other(s). Esteban On Tue, Dec 10, 2013 at 2:38 PM, Nicolas Cellier < nicolas.cellier.aka.nice@gmail.com> wrote:
And then rejectAsSet: selectAsHeap: etc... A big -1
2013/12/10 Yuriy Tymchuk <yuriy.tymchuk@me.com>
On 10 Dec 2013, at 14:26, Roberto Minelli <roberto.minelli@usi.ch> wrote:
No. Since #flatCollectAsSet: is in the image, #collectAsSet: should be in the image as well.
And then, since we want clean code #collectAsSet: is cleaner than #collect:as:.
Yes, but this also means that you need to implement:
collectAsArray: collectAsOrderedCollection: collectAsBag: â¦
:)
On Dec 10, 2013, at 2:23 PM, Esteban Lorenzano <estebanlm@gmail.com>
wrote:
I don't think it has to be in the image,
After all, you can just replace your calls for #collect:as:
Esteban
On Tue, Dec 10, 2013 at 2:21 PM, Roberto Minelli <
roberto.minelli@usi.ch> wrote:
Hi,
In Pharo 3 you guys integrated Doruâs CollectionsExtension package, which is great.
You forgot, however, to integrate the utility method #collectAsSet: I was using in several places in my code.
It should be simply ^ self collect: aBlock as: Set
Could someone please put this in the standard image please? Thanks.
Cheers, R
IMHO having two common usages of #flatCollect:as: and #collect:as: is good. Then, do whatever you want. In my image I have #collectAsSet:. On Dec 10, 2013, at 2:40 PM, Esteban Lorenzano <estebanlm@gmail.com> wrote:
IMO, if there is an error, then is the presence of #flatCollectAsSet:, not the absence of the other(s).
Esteban
On Tue, Dec 10, 2013 at 2:38 PM, Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> wrote: And then rejectAsSet: selectAsHeap: etc... A big -1
2013/12/10 Yuriy Tymchuk <yuriy.tymchuk@me.com>
On 10 Dec 2013, at 14:26, Roberto Minelli <roberto.minelli@usi.ch> wrote:
No. Since #flatCollectAsSet: is in the image, #collectAsSet: should be in the image as well.
And then, since we want clean code #collectAsSet: is cleaner than #collect:as:.
Yes, but this also means that you need to implement:
collectAsArray: collectAsOrderedCollection: collectAsBag: â¦
:)
On Dec 10, 2013, at 2:23 PM, Esteban Lorenzano <estebanlm@gmail.com> wrote:
I don't think it has to be in the image,
After all, you can just replace your calls for #collect:as:
Esteban
On Tue, Dec 10, 2013 at 2:21 PM, Roberto Minelli <roberto.minelli@usi.ch> wrote: Hi,
In Pharo 3 you guys integrated Doruâs CollectionsExtension package, which is great.
You forgot, however, to integrate the utility method #collectAsSet: I was using in several places in my code.
It should be simply ^ self collect: aBlock as: Set
Could someone please put this in the standard image please? Thanks.
Cheers, R
A fact is that there are way too many methods in (Sequenceable)Collection already, with duplicated implementations/features. So if collect:as: does the job why the hell add yet another selector? 2013/12/10 Roberto Minelli <roberto.minelli@usi.ch>
IMHO having two common usages of #flatCollect:as: and #collect:as: is good. Then, do whatever you want. In my image I have #collectAsSet:.
On Dec 10, 2013, at 2:40 PM, Esteban Lorenzano <estebanlm@gmail.com> wrote:
IMO, if there is an error, then is the presence of #flatCollectAsSet:, not the absence of the other(s).
Esteban
On Tue, Dec 10, 2013 at 2:38 PM, Nicolas Cellier < nicolas.cellier.aka.nice@gmail.com> wrote: And then rejectAsSet: selectAsHeap: etc... A big -1
2013/12/10 Yuriy Tymchuk <yuriy.tymchuk@me.com>
On 10 Dec 2013, at 14:26, Roberto Minelli <roberto.minelli@usi.ch> wrote:
No. Since #flatCollectAsSet: is in the image, #collectAsSet: should be in the image as well.
And then, since we want clean code #collectAsSet: is cleaner than #collect:as:.
Yes, but this also means that you need to implement:
collectAsArray: collectAsOrderedCollection: collectAsBag: â¦
:)
On Dec 10, 2013, at 2:23 PM, Esteban Lorenzano <estebanlm@gmail.com>
wrote:
I don't think it has to be in the image,
After all, you can just replace your calls for #collect:as:
Esteban
On Tue, Dec 10, 2013 at 2:21 PM, Roberto Minelli <
roberto.minelli@usi.ch> wrote:
Hi,
In Pharo 3 you guys integrated Doruâs CollectionsExtension package, which is great.
You forgot, however, to integrate the utility method #collectAsSet: I was using in several places in my code.
It should be simply ^ self collect: aBlock as: Set
Could someone please put this in the standard image please? Thanks.
Cheers, R
On 10 December 2013 14:47, Nicolas Cellier < nicolas.cellier.aka.nice@gmail.com> wrote:
A fact is that there are way too many methods in (Sequenceable)Collection already, with duplicated implementations/features. So if collect:as: does the job why the hell add yet another selector?
+1
2013/12/10 Roberto Minelli <roberto.minelli@usi.ch>
IMHO having two common usages of #flatCollect:as: and #collect:as: is good. Then, do whatever you want. In my image I have #collectAsSet:.
On Dec 10, 2013, at 2:40 PM, Esteban Lorenzano <estebanlm@gmail.com> wrote:
IMO, if there is an error, then is the presence of #flatCollectAsSet:, not the absence of the other(s).
Esteban
On Tue, Dec 10, 2013 at 2:38 PM, Nicolas Cellier < nicolas.cellier.aka.nice@gmail.com> wrote: And then rejectAsSet: selectAsHeap: etc... A big -1
2013/12/10 Yuriy Tymchuk <yuriy.tymchuk@me.com>
On 10 Dec 2013, at 14:26, Roberto Minelli <roberto.minelli@usi.ch> wrote:
No. Since #flatCollectAsSet: is in the image, #collectAsSet: should be in the image as well.
And then, since we want clean code #collectAsSet: is cleaner than #collect:as:.
Yes, but this also means that you need to implement:
collectAsArray: collectAsOrderedCollection: collectAsBag: â¦
:)
On Dec 10, 2013, at 2:23 PM, Esteban Lorenzano <estebanlm@gmail.com>
wrote:
I don't think it has to be in the image,
After all, you can just replace your calls for #collect:as:
Esteban
On Tue, Dec 10, 2013 at 2:21 PM, Roberto Minelli <
roberto.minelli@usi.ch> wrote:
Hi,
In Pharo 3 you guys integrated Doruâs CollectionsExtension package, which is great.
You forgot, however, to integrate the utility method #collectAsSet: I was using in several places in my code.
It should be simply ^ self collect: aBlock as: Set
Could someone please put this in the standard image please? Thanks.
Cheers, R
-- Best regards, Igor Stasenko.
Do I really need to respond to this? Well you're lucky, my child not yet awoke: 1) size is often implemented O(1) above is O(n) 2) typing size is very short compared to open code you provided 3) size has many senders which makes it worth 4) size is part of ANSI Which of these points apply to (someCollection collectAsSet: #asUppercase) vs (someCollection collect: #asUppercase as: Set). But you could find better example of some more questionable methods in Squeak/Pharo. 2013/12/10 Roberto Minelli <roberto.minelli@usi.ch>
So if "self do: [:each | tally := tally + 1]" computes the size of a collection, why do we need the #size selector?
On Dec 10, 2013, at 3:08 PM, Igor Stasenko <siguctua@gmail.com> wrote:
So if collect:as: does the job why the hell add yet another selector?
On Dec 10, 2013, at 4:19 PM, Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> wrote:
Do I really need to respond to this?
No.
Well you're lucky, my child not yet awoke:
Is this a threat? :lol:
1) size is often implemented O(1) above is O(n) 2) typing size is very short compared to open code you provided 3) size has many senders which makes it worth 4) size is part of ANSI Which of these points apply to (someCollection collectAsSet: #asUppercase) vs (someCollection collect: #asUppercase as: Set).
Anyway, this is an endless discussion. You have your point. I have mine. I have my own #collectAsSet: and I am fine with that and I will never use #collect:as:
But you could find better example of some more questionable methods in Squeak/Pharo.
2013/12/10 Roberto Minelli <roberto.minelli@usi.ch> So if "self do: [:each | tally := tally + 1]" computes the size of a collection, why do we need the #size selector?
On Dec 10, 2013, at 3:08 PM, Igor Stasenko <siguctua@gmail.com> wrote:
So if collect:as: does the job why the hell add yet another selector?
A threat? You're completely miss-understanding me, it just that it gave me some time to answer you. As long as it's your images, you're free man, implement whatever you like. Weren't we speaking of incorporating some messages in trunk development? Then you have to deal with other's opinion. Mine does not count that much. At the end, anyway, Steph and Marcus decide. 2013/12/10 Roberto Minelli <roberto.minelli@usi.ch>
On Dec 10, 2013, at 4:19 PM, Nicolas Cellier < nicolas.cellier.aka.nice@gmail.com> wrote:
Do I really need to respond to this?
No.
Well you're lucky, my child not yet awoke:
Is this a threat? :lol:
1) size is often implemented O(1) above is O(n) 2) typing size is very short compared to open code you provided 3) size has many senders which makes it worth 4) size is part of ANSI Which of these points apply to (someCollection collectAsSet: #asUppercase) vs (someCollection collect: #asUppercase as: Set).
Anyway, this is an endless discussion. You have your point. I have mine. I have my own #collectAsSet: and I am fine with that and I will never use #collect:as:
But you could find better example of some more questionable methods in Squeak/Pharo.
2013/12/10 Roberto Minelli <roberto.minelli@usi.ch> So if "self do: [:each | tally := tally + 1]" computes the size of a collection, why do we need the #size selector?
On Dec 10, 2013, at 3:08 PM, Igor Stasenko <siguctua@gmail.com> wrote:
So if collect:as: does the job why the hell add yet another selector?
On Dec 10, 2013, at 5:09 PM, Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> wrote:
A threat? You're completely miss-understanding me,
I was kidding ;)
it just that it gave me some time to answer you. As long as it's your images, you're free man, implement whatever you like. Weren't we speaking of incorporating some messages in trunk development? Then you have to deal with other's opinion. Mine does not count that much. At the end, anyway, Steph and Marcus decide.
2013/12/10 Roberto Minelli <roberto.minelli@usi.ch>
On Dec 10, 2013, at 4:19 PM, Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> wrote:
Do I really need to respond to this?
No.
Well you're lucky, my child not yet awoke:
Is this a threat? :lol:
1) size is often implemented O(1) above is O(n) 2) typing size is very short compared to open code you provided 3) size has many senders which makes it worth 4) size is part of ANSI Which of these points apply to (someCollection collectAsSet: #asUppercase) vs (someCollection collect: #asUppercase as: Set).
Anyway, this is an endless discussion. You have your point. I have mine. I have my own #collectAsSet: and I am fine with that and I will never use #collect:as:
But you could find better example of some more questionable methods in Squeak/Pharo.
2013/12/10 Roberto Minelli <roberto.minelli@usi.ch> So if "self do: [:each | tally := tally + 1]" computes the size of a collection, why do we need the #size selector?
On Dec 10, 2013, at 3:08 PM, Igor Stasenko <siguctua@gmail.com> wrote:
So if collect:as: does the job why the hell add yet another selector?
At the end, anyway, Steph and Marcus decide.
No :) We decide. So YOUR point of views are important because we can be in a bad mood not smart enough or whatever :). Now at the end of this discussion I have the impression that having collect:as: and flatCollect:as: would be good and enough Notice that I'm dead (gave 3 hours lectures from 6 - 9h and before talk from 1h30 to 6 about Smalltalk and research with guys at Prague) Stef
I think that collectAsSet: is used a lot because we convert collection and remove duplicates. So it wonât be the same with select: . But I prefer to use #removeDuplicates, because this explicitly says: I want to remove duplicates, and not use a side effects of Set. Anyway have a nice day guys, we are building an amazing system. Cheers! Uko On 10 Dec 2013, at 14:38, Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> wrote:
And then rejectAsSet: selectAsHeap: etc... A big -1
2013/12/10 Yuriy Tymchuk <yuriy.tymchuk@me.com>
On 10 Dec 2013, at 14:26, Roberto Minelli <roberto.minelli@usi.ch> wrote:
No. Since #flatCollectAsSet: is in the image, #collectAsSet: should be in the image as well.
And then, since we want clean code #collectAsSet: is cleaner than #collect:as:.
Yes, but this also means that you need to implement:
collectAsArray: collectAsOrderedCollection: collectAsBag: â¦
:)
On Dec 10, 2013, at 2:23 PM, Esteban Lorenzano <estebanlm@gmail.com> wrote:
I don't think it has to be in the image,
After all, you can just replace your calls for #collect:as:
Esteban
On Tue, Dec 10, 2013 at 2:21 PM, Roberto Minelli <roberto.minelli@usi.ch> wrote: Hi,
In Pharo 3 you guys integrated Doruâs CollectionsExtension package, which is great.
You forgot, however, to integrate the utility method #collectAsSet: I was using in several places in my code.
It should be simply ^ self collect: aBlock as: Set
Could someone please put this in the standard image please? Thanks.
Cheers, R
On 10 Dec 2013, at 14:23, Esteban Lorenzano <estebanlm@gmail.com> wrote:
I don't think it has to be in the image,
After all, you can just replace your calls for #collect:as:
I agree. But either you have both collectAsSet: flatCollectAsSet: or you have none. But now there is only flatCollectAsSet: which rises a question: âwhy there is no collectAsSet: ?â Cheers! Uko
Esteban
On Tue, Dec 10, 2013 at 2:21 PM, Roberto Minelli <roberto.minelli@usi.ch> wrote: Hi,
In Pharo 3 you guys integrated Doruâs CollectionsExtension package, which is great.
You forgot, however, to integrate the utility method #collectAsSet: I was using in several places in my code.
It should be simply ^ self collect: aBlock as: Set
Could someone please put this in the standard image please? Thanks.
Cheers, R
participants (7)
-
Benjamin -
Esteban Lorenzano -
Igor Stasenko -
Nicolas Cellier -
Roberto Minelli -
Stéphane Ducasse -
Yuriy Tymchuk