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

Jakob Reschke forums.jakob at resfarm.de
Wed Dec 5 22:44:31 UTC 2018


With #extent: and #corner: we "just know" that these are for creating
Rectangles. Just like we have learned that the symbol + is not about two
things crossing, but about adding things together, especially when it is
surrounded by numbers. Creating a new "well-known" word from the very
beginning is harder and you suddenly realize that all of the selectors
without "rectangle" in their name only make sense when you assume a 2D
graphics environment as the context, as opposed to, well, banking software,
maybe? But since the class Point is for 2D coordinates in such an
environment anyway, this can be justified.

Maybe you should ask yourself how you would like the expression to read if
it were the printString of the Rectangle. And when you think about it,
switch on and off in your mind the assumption that you already know you are
creating a rectangle when you evaluate the result. For #extent:, you have
to assume that, don't you? Otherwise 5 at 5 extent: 10 at 10 could also be a
circle... interestingly, then I would assume it to be centered at 5 at 5
already. 5 at 5 corner: 10 at 10 seems less ambiguous to me. After all, circles
don't have corners...

(0 at 0 extent: 10 at 10) printString
==> '5 at 5 inflate: 10 at 10' ? Does not seem natural to me. This relates to
Nicolas's verb vs. noun argument.
==> '5 at 5 surroundedBy: 10 at 10'
==> '5 at 5 inTheMiddleOf: 10 at 10' (well, misleading example... think of '50 at 50
inTheMiddleOf: 10 at 10' instead)
==> '5 at 5 amidst: 10 at 10'
==> '10 at 10 around: 5 at 5'
==> '10 at 10 withCenter: 5 at 5'
==> '10 at 10 centeredAt: 5 at 5'
(repeating other's suggestions now, purposely uncommented)
==> '5 at 5 extendTo: 10 at 10'
==> '5 at 5 spreadTo: 10 at 10'
==> '5 at 5 spreadToExtent: 10 at 10'
==> '5 at 5 rectangleWithExtent: 10 at 10'
==> '10 at 10 asRectangleCentredAt: 5 at 5'
==> '5 at 5 centredRectangleWithExtent: 10 at 10'
==> '5 at 5 centredRectangleExtent: 10 at 10'

Am Mi., 5. Dez. 2018 um 22:32 Uhr schrieb Nicolas Cellier <
nicolas.cellier.aka.nice at gmail.com>:

>
>
> Le mer. 5 déc. 2018 à 16:59, Tm Jhnsn <digit at sonic.net> a écrit :
>
>>
>> On Dec 4, 2018, at 12:12 AM, marcel.taeumel wrote:
>>
>> > Yet, such an infix notation for rectangle creation would not be
>> > much of an
>> > improvement over Rectangle class >> center:extent:.
>> >
>> > Very interesting. :-) Thoughts?
>>
>> Balloons inflate, and Smalltalk is quite associated with balloons... :)
>>
>> Tim J
>>
>
> But in this case, should deflate return the center ? (100 at 100 inflate:
> 50 at 30) deflate.
> I like spread because there is a kind of isotropic notion, we extend in
> all directions...
>
> The lexical field of symmetry may fit: we construct a rectangle by taking
> those two vertices:
> - image of aPoint by symmetry around myself,
> - and aPoint.
> So it's somehow a mirroring action:
>
>     centerPoint mirror: cornerPoint.
>     centerPoint reflect: cornerPoint.
>
> We could also think of pivoting or unfolding in the 3rd dimension...
> But I find the intention very hard to grasp... It's not obvious that the
> message should answer a Rectangle rather than a Point.
> And the meaning of argument slipped from extent to corner which is a
> different action...
>
> I note that inflate, spread, etc... are verbs, while corner: and extent:
> are nouns...
> We understand corner: and extent: because we may think of them as
> attributes of a Rectangle... (or just because we're used to them?)
> In this case, diagonal: may fit too, but the difference with extent: is
> thin, and I don't find the notion of isotropic spread in it.
> In fact, diagonal: might be to vertex:vertex: what corner: is to
> origin:corner: because we can define a rectangle by any of its diagonals...
>
> Geometrically, we may also see self and extentPoint as defining the
> diagonal by a center and a diameter of circumscribing circle...
> So its a kind of circumExtent: that we pass to the center... Not very
> clear that it will answer a Rectangle...
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20181205/750776f6/attachment-0001.html>


More information about the Squeak-dev mailing list