I was thinking to myself that I need a nice easy way of bunging objects into a collection and getting them out again. Kind of like a Dictionary where you can retrieve and object on a key, but kind of like a Set too. I thought I know what a Set which has Keyed behaviour! Lo and behond I found just the ticket. KeyedSet! Fantastic. I popped it into my root object in my brand new database. Copied loads of data over and slept on it.
This morning I open a session on my database and discover that when Magma loads the database back in it appears to have lost its keyBlock:
chris?
best regards
Keith
___________________________________________________________ To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com
Hi Keith, please be sure to checkout this page:
http://minnow.cc.gatech.edu/squeak/5722
and scroll to the bottom where it says "CAUTION: Unsupported". KeyedSet is (implicitly) part of that list.
Set and Dictionary are handled "logically" to avoid spurious, false change detection. For a detailed explanation,
http://lists.squeakfoundation.org/pipermail/squeak-dev/2004-July/079600.html
To avoid this problem, Magma handles Sets and Dictionary's logical-representation with indexed instance variables (i.e., stored and retrieved like Array's). The cost of doing this is, it exposes a limitation of Magma that I have not yet had time to fix; support for both named and indexed variables in the same class.
KeyedSet adds a named instance variable to a class that Magma treats as indexed, so it is not supported. It definitely can be, and if you wish to work on it I would be grateful. But it will require some careful changes to "Ma object serialization" package and probably "Ma traverse object graphs" too.
Regards, Chris
--- Keith Hodges Keith.Hodges@warwick.ac.uk wrote:
I was thinking to myself that I need a nice easy way of bunging objects into a collection and getting them out again. Kind of like a Dictionary where you can retrieve and object on a key, but kind of like a Set too. I thought I know what a Set which has Keyed behaviour! Lo and behond I found just the ticket. KeyedSet! Fantastic. I popped it into my root object in my brand new database. Copied loads of data over and slept on it.
This morning I open a session on my database and discover that when Magma loads the database back in it appears to have lost its keyBlock:
chris?
best regards
Keith
___________________________________________________________ To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com _______________________________________________ Magma mailing list Magma@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/magma
Hi,
KeyedSet adds a named instance variable to a class that Magma treats as indexed, so it is not supported. It definitely can be, and if you wish to work on it I would be grateful. But it will require some careful changes to "Ma object serialization" package and probably "Ma traverse object graphs" too.
The framework is already in Magma - there are just some cases to iron out in the serialisation of these instances.
I can help with advise if Keith/anyone is willing to pursue it.
Brent
So am I correct if I assume that KeyedSet will work if you do not define a keyBlock since it will use a default. Thus the easiest work around is to ensure that all the objects in the set provide a #key for now.
I for one will leave proper fixes until I have some spare time.
Keith
___________________________________________________________ Now you can scan emails quickly with a reading pane. Get the new Yahoo! Mail. http://uk.docs.yahoo.com/nowyoucan.html
I studied the code and.. it *looks* like you are correct, but let me say you should do some good testing to be sure yourself.
The interesting thing is, it looks like I started to work on this issue at one point, check out the method Set>>#maStreamVariablyInto:for:. In there it actually accounts for additional instVars beyond the 'array' and 'tally'.. Interesting.
But its unfinished, of course, because Set class>>#maLoadVariableObjectFrom: and Set>>#maEstablishPointerReferencesUsing: do not have the same consideration.. They merely use Sets public API (#do:, #add:, etc.) to do the work so it seems like your assumption should work. Please proceed with caution and test it real well though..
Regards, Chris
--- Keith Hodges Keith.Hodges@warwick.ac.uk wrote:
So am I correct if I assume that KeyedSet will work if you do not define a keyBlock since it will use a default. Thus the easiest work around is to ensure that all the objects in the set provide a #key for now.
I for one will leave proper fixes until I have some spare time.
Keith
___________________________________________________________ Now you can scan emails quickly with a reading pane. Get the new Yahoo! Mail. http://uk.docs.yahoo.com/nowyoucan.html _______________________________________________ Magma mailing list Magma@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/magma
magma@lists.squeakfoundation.org