Error when removing the last method from a MessageSet

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Error when removing the last method from a MessageSet

Levente Uzonyi-2
Hi,

I was removing all methods from an implementors browser and when I removed
the last one, I got an error (attemt to index non-existent element in an
ordered collection), because Browser >> #reformulateList is not prepared
for this case. A possible solution is to return nil from #lastMessageName
when there are no messages, though I'm not 100% sure this is the right
thing to do.

Cheers,
Levente

Reply | Threaded
Open this post in threaded view
|

Re: Error when removing the last method from a MessageSet

Frank Shearar
On 2011/04/26 01:16, Levente Uzonyi wrote:
> Hi,
>
> I was removing all methods from an implementors browser and when I
> removed the last one, I got an error (attemt to index non-existent
> element in an ordered collection), because Browser >> #reformulateList
> is not prepared for this case. A possible solution is to return nil from
> #lastMessageName when there are no messages, though I'm not 100% sure
> this is the right thing to do.

OK, Tools-fbs.345 fixes this.

At some point in the future I want to make MessageSet subclass
CodeHolder directly (or a new subclass thereof) rather than keep the
current subclassing of Browser.

It doesn't make much sense, and it makes trouble in various parts of
Browser, where we have Browsers using the contents instvar in one way,
and MessageSets using the same instance another way. See the comment in
MessageSet>>#setContentsToForceRefetch:

"Set the receiver's contents such that on the next update the contents
will be formulated afresh.  This is a critical and obscure difference
between Browsers on the one hand and MessageSets on the other, and has
over the years been the source of much confusion and much difficulty.
By centralizing the different handling here, we don't need so many
idiosyncratic overrides in MessageSet any more"

When I split MessageSet out, I might have to do something different to
ensure we don't have a regression (because I've edited Browser, not
MessageSet).

frank