[Newbies] Help! can't see inside a Bag

Chris Cunningham cunningham.cb at gmail.com
Wed Apr 20 20:15:45 UTC 2016

HI Joe,
A Bag is a structure to hold multiple, possibly repeating, objects in it.
One of the benefits is to know how many times an object is inside of the
bag - how many times it repeats.

Bag is implemented with a Dictionary it in - the key is the objects that
you put into the bag, and the value is the count of how many times it was
put into the bag (hence all of the 1's that you see - they were probably
just added once to the bag).

The explorer is optimized to make Dictionary navigation fast and convenient
for normal Dictionaries - you can see and select the key, and get to see
the details of the values in the dictionary.
It is not optimized for looking at the dictionary in the Bag, where you
care about the key (and mostly not about the value - at least for your use

To explore the values in the Bag, I would suggest one of two ways of
getting at the data:
1> send #asSet to the bag, and explore that
2> send #keys to the dictionary, and explore that
Either should work.

One more thing to think about - if you aren't going to have multiples of
your Transaction objects (or don't care to know that you have multiple of
them) in your Bag, you might want to consider using a Set instead.


On Wed, Apr 20, 2016 at 12:31 PM, Joseph Alotta <joseph.alotta at gmail.com>

> Help!
> I have a data structure as the screenshot below shows.
> There is a Bag with Transaction objects.
> I can’t see inside the Transaction objects?
> Why is there a Dictionary?
> I can see the beginning of the transaction data, but I can’t the the whole
> line?
> When I explore, it opens a window on Integer 1.  Where are all the 1s
> coming from?
> Sincerely,
> Joe.
> here is the link: https://www.flickr.com/photos/jalotta/26480315621/
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20160420/7995c616/attachment.htm

More information about the Beginners mailing list