[Cuis] Dictionary asSet
Dan Norton
dnorton at mindspring.com
Sun Mar 1 10:42:51 CST 2015
Comments in line...
On 1 Mar 2015 at 15:06, 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.
>
Someone looking at the Terse Guide sees #asOrderedCollection, #asBag, etc. answer the
values of the dictionary in instances of those classes. So they might expect #asSet to follow
suit.
In Cuis, Dictionary inherits from Set, unlike Squeak. Seems like Dictionary needs to have its
own #asSet method.
>
> 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.
>
How about...
asSetTest
| dx old new |
dx _ Dictionary new
at: #foo put: 44; at: #bah put: 55; yourself.
old _ dx className asSymbol.
new _ dx asSet className asSymbol.
self shouldnt: [old = new]
>
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jvuletich.org/pipermail/cuis_jvuletich.org/attachments/20150301/e08bc61e/attachment-0004.html>
More information about the Cuis
mailing list