[squeak-dev] The Trunk: Graphics-mt.404.mcz

David T. Lewis lewis at mail.msen.com
Wed Dec 5 03:29:23 UTC 2018


On Tue, Dec 04, 2018 at 02:12:11AM -0600, marcel.taeumel wrote:
> Hi, there. :-)
> 
> I didn't put it into the inbox because 1) I wanted to speed up the
> discussion and 2) thought this is a good name along Point >> #extent: and
> #corner:. Whatever we choose to improve consistency here, those messages
> should be considered, too.
> 
> <offtopic> Anyway, there is no such thing as "garbage version in the
> ancestry". This is not George Orwell's 1984 where people dictate or rewrite
> history. History becomes what has happened. If a database (back-end) or
> algorithm gets confused with this kind of events, then that database has to
> be fixed. Not the data. :-) Just my two cents. </offtopic>
> 
> Sorry for any inconveniences.
> 
> So, what do we have up to here:
> 
> - #inflate:, #extent:, #corner:
> - #extendTo:, #extent:, #corner:
> - #spreadTo:, #extent:, #corner:
> - #spreadToExtent:, #extent:, #corner:
> - #rectangleWithExtent:, #extent:, #corner:
> - #centredRectangleWithExtent:, #extent:, #corner:
> - #centredRectangleExtent:, #extent:, #corner:
> 
> Eliot suggests to maybe treat the point as extent, not position information:
> 
> - #asRectangleCentredAt:, (#asRectangleOriginAt:)
> 
> So far, I do not like any of the suggestions because I see the triple of
> (?/#extent:/#corner:) as more important than the perfect wording for that
> single new message that calls Rectangle class >> #center:extent:. It is no
> option to rename (and deprecate) #extent: and #corner: because of existing
> code.
> 
> Instead, we could introduce three (or four?) new messages that all improve
> on the wording. Maybe:
> 
> #asRectangleOriginWithExtent:
> #asRectangleCenterWithExtent:
> #asRectangleOriginWithCorner:
> #asRectangleCenterWithCorner:
> 
> Yet, such an infix notation for rectangle creation would not be much of an
> improvement over Rectangle class >> center:extent:.
> 
> Very interesting. :-) Thoughts?

When I look at it in a browser, as opposed to email discussion, I am happy
with #inflate: because it is consistent with #corner: and #extent: all of
which are in method category 'converting'.

Each of these answers a Rectangle with an extent defined by the argument.
The receiver is a position, the argument is an extent, and the result
is a rectangle.

I don't think that a different selector is needed, but if I were to
suggest one it would be Point>>center: instead of Point>>inflate:.

This would be a change from this:

  Point>>inflate: aPoint 
      "Answer a Rectangle whose center is the receiver and whose extent is 
      aPoint. This is one of the infix ways of expressing the creation of a 
      rectangle."

      ^Rectangle center: self extent: aPoint

To this:

  Point>>>center: extent
      "Answer a Rectangle whose center is the receiver and whose extent is 
      extent. This is one of the infix ways of expressing the creation of a 
      rectangle."

      ^Rectangle center: self extent: extent


But #inflate: is good, and it is supported by unit tests, so I am happy
with #inflate:.

Dave


More information about the Squeak-dev mailing list