help-smalltalk
[Top][All Lists]
Advanced

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

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


From: Stephen Compall
Subject: Re: [Help-smalltalk] CharacterArray class>>#lineDelimiter and Dictionary>>#addAll: both fail
Date: Thu, 22 Mar 2007 18:25:39 -0500

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.

Perhaps a new method, like addAllAssociations:, which would be
semantically equivalent to "arg associationsDo: [:assoc|self at: assoc
key put: assoc value]", would be more appropriate?

-- 
;;; Stephen Compall ** http://scompall.nocandysw.com/blog **
"Peta" is Greek for fifth; a petabyte is 10 to the fifth power, as
well as fifth in line after kilo, mega, giga, and tera.
  -- Lee Gomes, performing every Wednesday in his tech column
     "Portals" on page B1 of The Wall Street Journal

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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