[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] CharacterArray class>>#lineDelimiter and Dictionary

From: Jānis Rūcis
Subject: Re: [Help-smalltalk] CharacterArray class>>#lineDelimiter and Dictionary>>#addAll: both fail
Date: Fri, 23 Mar 2007 02:29:48 +0200
User-agent: Icedove (X11/20061220)

Stephen Compall wrote:
> On Tue, 2007-03-20 at 14:54 +0100, Paolo Bonzini wrote:
>>> Also, #addAll: doesn't work on Dictionaries:
>>> I believe it should iterate directly over elements and not their values.
>> It should use #keysAndValuesDo:, indeed.
> Its current meaning lends itself to the extremely convenient
> Dictionary withAll: {#a -> 1. #b -> 2}.
> as class>>withAll: is defined as something like "self new addAll: arg".
> I prefer the semantics of addAll: to definitely be "arg do: [:each|self
> add: each]", but this would change or be special-cased if you could
> addAll: aDictionary in the manner parasti speaks of.

I remember now that I was a bit surprised to discover that, in
Dictionaries, #do: is, in fact, redefined to iterate over values, and
not the Associations (which is what I meant by "elements").  Removing it
would preserve the indeed useful behaviour you demonstrated in your
example and also make it behave the way I expected.  And probably break
something.  :-)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]