[Pharo-project] bug on dictionary?
Hi, I have this issue: Dictionary with: #one->'ONE' with: #two->'TWO' "This gives me a correct Dictionary with keys #one, #two and values 'ONE', 'TWO'" Dictionary withAll: {#one->1 with: #two->2} "This gives me a Dictionary with keys 1,1 and values #one->'ONE', #two->'TWO' So... I think one of both is incorrect... or at least, the API sucks because is too confusing. cheers, Esteban
On Mon, May 14, 2012 at 3:42 PM, Esteban Lorenzano <estebanlm@gmail.com> wrote:
Dictionary withAll: {#one->1 with: #two->2}
your #with: is suspicious :-) -- Damien Cassou http://damiencassou.seasidehosting.st "Lambdas are relegated to relative obscurity until Java makes them popular by not having them." James Iry
maybe :) I use #with: a lot, but I agree that one of the two approaches is wrong... it should be a coherent API. Esteban On Mon, May 14, 2012 at 3:54 PM, Damien Cassou <damien.cassou@gmail.com>wrote:
On Mon, May 14, 2012 at 3:42 PM, Esteban Lorenzano <estebanlm@gmail.com> wrote:
Dictionary withAll: {#one->1 with: #two->2}
your #with: is suspicious :-)
-- Damien Cassou http://damiencassou.seasidehosting.st
"Lambdas are relegated to relative obscurity until Java makes them popular by not having them." James Iry
On 14 May 2012, at 15:54, Damien Cassou wrote:
On Mon, May 14, 2012 at 3:42 PM, Esteban Lorenzano <estebanlm@gmail.com> wrote:
Dictionary withAll: {#one->1 with: #two->2}
your #with: is suspicious :-)
-- Damien Cassou http://damiencassou.seasidehosting.st
"Lambdas are relegated to relative obscurity until Java makes them popular by not having them." James Iry
He meant, Dictionary withAll: {#one->1. #two->2} And he is right: the #withAll: comes down to a #addAll: with expects another keyedCollection, not a collection of associations. Sven
oops... yep, my mistake. You see, we should use copy&paste ;) but Sven is right :P On Mon, May 14, 2012 at 4:08 PM, Sven Van Caekenberghe <sven@beta9.be>wrote:
On 14 May 2012, at 15:54, Damien Cassou wrote:
On Mon, May 14, 2012 at 3:42 PM, Esteban Lorenzano <estebanlm@gmail.com> wrote:
Dictionary withAll: {#one->1 with: #two->2}
your #with: is suspicious :-)
-- Damien Cassou http://damiencassou.seasidehosting.st
"Lambdas are relegated to relative obscurity until Java makes them popular by not having them." James Iry
He meant,
Dictionary withAll: {#one->1. #two->2}
And he is right: the #withAll: comes down to a #addAll: with expects another keyedCollection, not a collection of associations.
Sven
grrr. "we shouldn't" :) On Mon, May 14, 2012 at 4:11 PM, Esteban Lorenzano <estebanlm@gmail.com>wrote:
oops... yep, my mistake. You see, we should use copy&paste ;)
but Sven is right :P
On Mon, May 14, 2012 at 4:08 PM, Sven Van Caekenberghe <sven@beta9.be>wrote:
On 14 May 2012, at 15:54, Damien Cassou wrote:
On Mon, May 14, 2012 at 3:42 PM, Esteban Lorenzano <estebanlm@gmail.com> wrote:
Dictionary withAll: {#one->1 with: #two->2}
your #with: is suspicious :-)
-- Damien Cassou http://damiencassou.seasidehosting.st
"Lambdas are relegated to relative obscurity until Java makes them popular by not having them." James Iry
He meant,
Dictionary withAll: {#one->1. #two->2}
And he is right: the #withAll: comes down to a #addAll: with expects another keyedCollection, not a collection of associations.
Sven
maybe we should even start considering again replacing dict + set with something more standard that internally relies on buckets instead of associations. I've shown in my master thesis that the bucket implementation performs slightly better or the at least the same in various use-cases. On 2012-05-14, at 15:54, Damien Cassou wrote:
On Mon, May 14, 2012 at 3:42 PM, Esteban Lorenzano <estebanlm@gmail.com> wrote:
Dictionary withAll: {#one->1 with: #two->2}
your #with: is suspicious :-)
-- Damien Cassou http://damiencassou.seasidehosting.st
"Lambdas are relegated to relative obscurity until Java makes them popular by not having them." James Iry
On 14 May 2012, at 16:10, Camillo Bruni wrote:
maybe we should even start considering again replacing dict + set with something more standard that internally relies on buckets instead of associations.
I've shown in my master thesis that the bucket implementation performs slightly better or the at least the same in various use-cases.
Better implementations would always be welcome. For example, choosing between regular and small dictionary should be an automatic internal detail. Exposing associations as an implementation details is of course wrong. But one could keep the association concept at the API level and do a more intelligent implementation. But that doesn't change the value of the original issue: Dictionary>>#add: and Dictionary>>#addAll: do conflict in a certain sense. Sven
On 2012-05-14, at 16:22, Sven Van Caekenberghe wrote:
On 14 May 2012, at 16:10, Camillo Bruni wrote:
maybe we should even start considering again replacing dict + set with something more standard that internally relies on buckets instead of associations.
I've shown in my master thesis that the bucket implementation performs slightly better or the at least the same in various use-cases.
Better implementations would always be welcome.
For example, choosing between regular and small dictionary should be an automatic internal detail.
- been there done that :P in our Pinocchio Dictionary we did that :)
Exposing associations as an implementation details is of course wrong.
- exactly, they're a nice interface but that should be all
But one could keep the association concept at the API level and do a more intelligent implementation.
But that doesn't change the value of the original issue:
Dictionary>>#add:
and
Dictionary>>#addAll:
do conflict in a certain sense.
Sven
participants (4)
-
Camillo Bruni -
Damien Cassou -
Esteban Lorenzano -
Sven Van Caekenberghe