[squeak-dev] The Inbox: Graphics-cbc.372.mcz

Chris Cunningham cunningham.cb at gmail.com
Wed Mar 29 21:54:47 UTC 2017


Hi.

On Wed, Mar 29, 2017 at 12:58 PM, Eliot Miranda <eliot.miranda at gmail.com>
wrote:

> Hi Hannes,
>
> On Wed, Mar 29, 2017 at 8:45 AM, H. Hirzel <hannes.hirzel at gmail.com>
> wrote:
>
>> Hi Chris,
>>
>> On 3/29/17, Chris Cunningham <cunningham.cb at gmail.com> wrote:
>> > Hi,
>
> <snip>


> The kind of thinking which restricts the system, such as adding methods
>> that logically belong to SequenceableCollection to, say, String, simply
>> because the programmer wanted a String method and didn't think about
>> generality, is at best regrettable.
>
> I've been guilty of this in the past, and probably will in the future, but
I try not to be.

>
>
>
> > A better question is should I be using Rectangle for this.  Maybe we
>> should
>> > create a 'TrueRectangle' class or something similar so that we can
>> actually
>> > talk about and share what can really be done with rectangles, instead of
>> > the 'ScreenRectangle' that we have today called Rectangle.
>>
>
> Why not the other way around? Add IntegralRectangle and have it specialize
> Rectangle.
>
>
Let me re-state what I think you are saying, and please correct me if I am
wrong.

Make Rectangle more generic, and for instance, have the method
#center:extent: use #/ instead of #//.
Then, have a new class, IntegralRectangle, that re-implements that method
and sends #// to ensure that the extents are integral.
(and in general do whatever else is needed to relax Rectangle, and tighten
up IntegralRectangle).

Right?

If so, the main reason not to do proceed is that Rectangle is used
extensively in the system for today, and we'd have to replace those uses
with IntegralRectangle, not to mention all of the indirect uses (such as
#corner: that you used above, and make variants creating IntegralRectangle
and generic Rectangle, or otherwise resolve those ambiguities).

That said, I'm all for it.  I'd like a less strict Rectangle for, well,
Rectangle uses.

As a side note, if you look up Integral Rectangle in Google, you'll fine
lots of discussions that have nothing to do with this question.  But
Integral (integer) and Rectangle make perfect sense here in any case.

-cbc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20170329/e3724cca/attachment.html>


More information about the Squeak-dev mailing list