[Cuis] Dictionary asSet

Dan Norton dnorton at mindspring.com
Wed Mar 4 15:45:11 CST 2015


On 1 Mar 2015 at 16:06, Juan Vuletich wrote:

> 
> In Squeak, 'someDictionary asSet' answers a set with the values. It
> should do the same in Cuis, 
> (like Dan and Nicolas want). Maybe we'd also adopt the idea of
> having HashedCollection as a 
> superclass of both Dictionary and Set, just like in Squeak.
> 
> Any takers?
> 
> Cheers,
> Juan Vuletich
> 
> On 3/1/2015 11:06 AM, Nicolas Cellier wrote:
> 
> 
>     2015-03-01 10:52 GMT+01:00 Casey Ransberger
> <casey.obrien.r at gmail.com>:
>     I think it should probably answer a set of associations,
> specifically, and also have a 
>     gut feeling that doing so should be relatively cheap. But don't
> worry so much about 
>     what I think. Look at what the other dialects do, consult book
> blue, etc...
> 
> 
>     Please, no.
>     A Dictionary behaves as a Collection of values,  it's just that
> it has special keys for indexing 
>     its contents.
>     Why should asSet do something different than asArray for
> example?
>     If we want a set of associations, we can just write aDictionary
> associations asSet.
> 
>     Nicolas
> 
>     Annoying Casey behavior: can you think of an SUnit test that
> confirms the bug? I'm 
>     not just asking you for a test case, not necessarily, but it
> would be good to define 
>     expected behavior in a way that allows us later to know that it
> has changed 
>     inadvertently if it does.
> 
>     The test is more important than the fix, if the code is to be
> the curriculum. 
> 
>     --C
>     
>     On Feb 28, 2015, at 6:45 PM, "Dan Norton"
> <dnorton at mindspring.com> wrote:
> 
>     aDictionary asSet should answer a set. Instead, it answers
> itself (a dictionary).
> 
>     I tried to create a new issue but the "Submit new issue" button
> was disabled.
>
An #asSet method for Dictionary could be implemented as:
	^ self as: Set
which brings a question: in the spirit of Cuis, why not eliminate most of the #asXXX 
convenience methods, replacing them with the as: Class idiom wherever possible?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jvuletich.org/pipermail/cuis_jvuletich.org/attachments/20150304/42418fbb/attachment-0004.html>


More information about the Cuis mailing list