[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-smalltalk] Re: Dictionary>>#addAll: fails
From: |
Paolo Bonzini |
Subject: |
[Help-smalltalk] Re: Dictionary>>#addAll: fails |
Date: |
Mon, 26 Mar 2007 09:21:14 +0200 |
User-agent: |
Thunderbird 1.5.0.10 (Macintosh/20070221) |
Stephen Compall wrote:
> On Fri, 2007-03-23 at 15:26 +0100, Paolo Bonzini wrote:
>> One possibility could be to extend the {...} syntax to something
>> like "OrderedCollection {...}", "Dictionary {...}", and have it send
>> messages like "#braceWithAll:". Then you would have:
>
> I would rather leave the syntax alone and just add the protocol:
What about adding #from: ? I want it to be terse and still clear if
possible.
>> Dictionary >> braceWithAll: x
>> | dict |
>> dict := self new: x size * 2.
>
> I like these as they are, except for the * 2 in Dictionary's method.
Well, it's there because a hash table needs more room than it has
elements. In fact I'm about to add
HashedCollection >> withAll: x
| result |
result := self new: x size * 2.
result addAll: x.
^result
It does not apply to with:with: and friends only because of
new: anInteger
"Answer a new instance of the receiver with the given size"
| realSize |
realSize := 8 max: anInteger.
...
^(self primNew: realSize) initialize: realSize
Paolo
- Re: [Help-smalltalk] CharacterArray class>>#lineDelimiter and Dictionary>>#addAll: both fail, (continued)
- 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, 2007/03/22
- 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 <=
- [Help-smalltalk] Re: Dictionary>>#addAll: fails, Stephen Compall, 2007/03/29
- Re: [Help-smalltalk] Re: Dictionary>>#addAll: fails, Paolo Bonzini, 2007/03/30
- [Help-smalltalk] Re: Dictionary>>#addAll: fails, Stephen Compall, 2007/03/29
- [Help-smalltalk] Re: Dictionary>>#addAll: fails, Jānis Rūcis, 2007/03/29
- [Help-smalltalk] Re: Dictionary>>#addAll: fails, Stephen Compall, 2007/03/29
- [Help-smalltalk] Re: Dictionary>>#addAll: fails, Jānis Rūcis, 2007/03/30
- [Help-smalltalk] Re: Dictionary>>#addAll: fails, Stephen Compall, 2007/03/30
- [Help-smalltalk] Re: Dictionary>>#addAll: fails, Jānis Rūcis, 2007/03/31
- Re: [Help-smalltalk] Re: Dictionary>>#addAll: fails, Paolo Bonzini, 2007/03/31
- [Help-smalltalk] Re: Dictionary>>#addAll: fails, Stephen Compall, 2007/03/31