Collection squared but what about fractions.

John M McIntosh johnmci at smalltalkconsulting.com
Tue Jun 5 00:33:31 UTC 2001


>John,
>
>How about making a little tweak in Fraction along the lines of:
>
>Fraction>>* aNumber
>	self == aNumber ifTrue:[
>		"special case for squaring fractions"
>		^self squared]
>	"...."
>
>This might even help in some other cases (note that the above uses #== to
>prevent doing a full comparison in case of a non-fractional argument).
>
>Cheers,
>   - Andreas

Well we could do that, I'd check first to see what the impact is, but 
since we already do some checking in Fraction>>* I doubt there will 
be any great impact.

However the issue is kind of still there, if you add a specialized 
squared routine for performance reasons, you don't get it invoked 
when dealing with collections.

-- 
--
===========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================





More information about the Squeak-dev mailing list