[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 1.5.0.9 (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. :-)
Jānis
- [Help-smalltalk] CharacterArray class>>#lineDelimiter and Dictionary>>#addAll: both fail, parasti, 2007/03/20
- Re: [Help-smalltalk] CharacterArray class>>#lineDelimiter and Dictionary>>#addAll: both fail, Paolo Bonzini, 2007/03/20
- Re: [Help-smalltalk] CharacterArray class>>#lineDelimiter and Dictionary>>#addAll: both fail, Stephen Compall, 2007/03/22
- Re: [Help-smalltalk] CharacterArray class>>#lineDelimiter and Dictionary>>#addAll: both fail,
Jānis Rūcis <=
- Re: [Help-smalltalk] CharacterArray class>>#lineDelimiter and Dictionary>>#addAll: both fail, Stephen Compall, 2007/03/22
- Re: [Help-smalltalk] CharacterArray class>>#lineDelimiter and Dictionary>>#addAll: both fail, Paolo Bonzini, 2007/03/23
- Re: [Help-smalltalk] CharacterArray class>>#lineDelimiter and Dictionary>>#addAll: both fail, Jānis Rūcis, 2007/03/23
- Re: [Help-smalltalk] CharacterArray class>>#lineDelimiter and Dictionary>>#addAll: both fail, Paolo Bonzini, 2007/03/23
- Re: [Help-smalltalk] CharacterArray class>>#lineDelimiter and Dictionary>>#addAll: both fail, Jānis Rūcis, 2007/03/23
- Re: [Help-smalltalk] CharacterArray class>>#lineDelimiter and Dictionary>>#addAll: both fail, Paolo Bonzini, 2007/03/23
- Re: [Help-smalltalk] Dictionary>>#addAll: fails, Stephen Compall, 2007/03/23
- [Help-smalltalk] Re: Dictionary>>#addAll: fails, Paolo Bonzini, 2007/03/26
- [Help-smalltalk] Re: Dictionary>>#addAll: fails, Stephen Compall, 2007/03/29
- Re: [Help-smalltalk] Re: Dictionary>>#addAll: fails, Paolo Bonzini, 2007/03/30