[FIX] PLMOfManyModelAccessFix-hpt ([sm] [et] [cd])

Hernan Tylim htylim at yahoo.com.ar
Mon Apr 5 14:40:21 UTC 2004


Hi, 

I tested the cs in a fresh 5868 image with the ChangeList browser and
the TestRunner. These two are the only ones in the basic image using the
PluggableListMorphOfMany. On the preamble it is documented the changes
and their motivation.

from preamble:

"Change Set:		PLMOfManyModelAccessFix-hpt
Date:				5 April 2004
Author:			Hernán Tylim

I found on PluggableListMorphOfMany an access to the model that wasn't
using the selectors that were given by the user but a hardcoded
#listSelectionAt:. 

Because this force the user to implement #listSelectionAt: on the model,
and because the class is already using a pluggable way to access the
selection, this .cs removes the hardcoded call (the only one in the
class in #itemSelectedAmongMultiple:) for a self listSelectionAt: which
access the model in the right way.
 
Also it fixes the class comment where was stated that the model must
implement #listSelectionAt: and #listSelectionAt:put:. The latter were
not used"

Regards, 
Hernán

> -----Original Message-----
> From: squeak-dev-bounces at lists.squeakfoundation.org
[mailto:squeak-dev-
> bounces at lists.squeakfoundation.org] On Behalf Of Doug Way
> Sent: Sunday, April 04, 2004 9:29 PM
> To: The general-purpose Squeak developers list
> Subject: Re: Question about PluggableListMorphOfMany
> 
> 
> Your change makes sense to me... it sounds like it was probably a bug
> that listSelectionAt: was hardcoded.
> 
> You could submit your change as a fix.  (Keep the explanation below in
> your fix.)  You might even leave out the ifNotNil: check and just do
> the "model perform: getSelectionListSelector ..." if that is really
> what is done everywhere else in the class.
> 
> - Doug
> 
> 
> On Apr 4, 2004, at 4:57 PM, Hernan Tylim wrote:
> 
> > Hi,
> >
> > I have a question about PluggableListMorphOfMany and I hope someone
of
> > you can help me.
> >
> > I found on the Class comments that PluggableListMorphOfMany require
the
> > model to implement #listSelectionAt: and #listSelectionAt:put:.
> >
> > My question is, why these selectors are hardcoded and don't use ones
> > passed on creation?
> >
> > I looked at the code and the only place where one of these methods
are
> > called is on:
> >
> > PluggableListMorphOfMany>>itemSelectedAmongMultiple: index
> > itemSelectedAmongMultiple: index
> > 	^model listSelectionAt: index
> >
> > I would rather propose:
> > itemSelectedAmongMultiple: index
> > 	^getSelectionListSelector
> > 		ifNotNil: [model perform: getSelectionListSelector with:
> > index]
> > 		ifNil: [model listSelectionAt: index]
> >
> > This would be ok? It seemed odd to me that everywhere in the class
were
> > used "model perform: getSelectionListSelector with: index", and only
on
> > that method used the a hardcoded listSelectionAt: call.
> >
> > Thanks
> >
> > Regards,
> > Hernán
> >
> >
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PLMOfManyModelAccessFix-hpt.1.cs.gz
Type: application/octet-stream
Size: 645 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20040405/c86f3c84/PLMOfManyModelAccessFix-hpt.1.cs.obj


More information about the Squeak-dev mailing list