I seem to remember this coming up in the past but a quick Google search doesn't turn anything up. It appears that GOODS is quite happy to store a BlockContext but it entirely unable to reinstantiate it. It attempts to use BlockContext (ContextPart) class>>basicNew: which throws a 'Contexts must only be created with newForMethod:' error. Quite a PITA when you want to store something in a SortedCollection. Oh well, I guess I can call OrderedCollection>>sortBy: every time I add a new item since adding is a comparatively rare action.
Ken
On 6/1/06, Ken Causey ken@kencausey.com wrote:
I seem to remember this coming up in the past but a quick Google search doesn't turn anything up. It appears that GOODS is quite happy to store a BlockContext but it entirely unable to reinstantiate it. It attempts to use BlockContext (ContextPart) class>>basicNew: which throws a 'Contexts must only be created with newForMethod:' error. Quite a PITA when you want to store something in a SortedCollection. Oh well, I guess I can call OrderedCollection>>sortBy: every time I add a new item since adding is a comparatively rare action.
Hi Ken,
Is there a reason you can't use one of the data structures in the BTree package? Those can be stored and retrieved from GOODS and are faster if you have a big collection of data anyway.
On a different note, I'd swear that a Seaside project I did about two years ago stored a SortedCollection in GOODS. I'll see if I can't find that image so I can tell you either what workaround I used or figure out what changed to break that behavior.
--Benjamin
On Thu, 2006-06-01 at 20:04 -0400, Benjamin Pollack wrote:
On 6/1/06, Ken Causey ken@kencausey.com wrote: I seem to remember this coming up in the past but a quick Google search doesn't turn anything up. It appears that GOODS is quite happy to store a BlockContext but it entirely unable to reinstantiate it. It attempts to use BlockContext (ContextPart) class>>basicNew: which throws a 'Contexts must only be created with newForMethod:' error. Quite a PITA when you want to store something in a SortedCollection. Oh well, I guess I can call OrderedCollection>>sortBy: every time I add a new item since adding is a comparatively rare action.
Hi Ken,
Is there a reason you can't use one of the data structures in the BTree package? Those can be stored and retrieved from GOODS and are faster if you have a big collection of data anyway.
Actually, I am using a BTree for my root. But in this case I simply needed a sortable ordered collection, not a dictionary-like structure, for this particular collection. I don't see how BTree fits in there. Am I missing something?
On a different note, I'd swear that a Seaside project I did about two years ago stored a SortedCollection in GOODS. I'll see if I can't find that image so I can tell you either what workaround I used or figure out what changed to break that behavior.
Thank you, I appreciate it.
Ken
--Benjamin
On 6/1/06, Ken Causey ken@kencausey.com wrote:
Actually, I am using a BTree for my root. But in this case I simply needed a sortable ordered collection, not a dictionary-like structure, for this particular collection. I don't see how BTree fits in there. Am I missing something?
No, you're not; I just wasn't thinking very clearly.
On a different note, I'd swear that a Seaside project I did about two
years ago stored a SortedCollection in GOODS. I'll see if I can't find that image so I can tell you either what workaround I used or figure out what changed to break that behavior.
Thank you, I appreciate it.
Unfortunately, my solution at the time was apparently to switch to Magma, so I don't have a good suggestion for you.
--Benjamin
Ken Causey wrote:
I seem to remember this coming up in the past but a quick Google search doesn't turn anything up. It appears that GOODS is quite happy to store a BlockContext but it entirely unable to reinstantiate it. It attempts to use BlockContext (ContextPart) class>>basicNew: which throws a 'Contexts must only be created with newForMethod:' error. Quite a PITA when you want to store something in a SortedCollection. Oh well, I guess I can call OrderedCollection>>sortBy: every time I add a new item since adding is a comparatively rare action.
Ken
One solution I've used is to create a SortCriteria class which answers value:value: as needed for a given situation.
David
squeak-dev@lists.squeakfoundation.org