The Voodoo of Inlined Methods

RT Happe rthappe at mathematik.uni-freiburg.de
Fri Jun 28 15:45:19 UTC 2002


On Fri, 28 Jun 2002, Richard A. O'Keefe wrote:
> Squeak does not (yet) do type inference, so it *can't* make inlining
> decisions based on the type of the receiver.  If it sees
> [A numbat is a small Australian marsupial carnivore.]
> a to: b do: [:each | ... ] and the expression a is not some kind
> of literal, it hasn't a clue whether a is a number or a numbat.

Thanks for the confirmation (and the zoological supplement).  I was
initially misled because the first version expecting a binary block
[:x :y | ...] appeared to work.  Only the follow-up with singulary
[:aPoint | ...] exposed the inline sends.

> 	(*) By the way, the intended ``upLeft to: bottomRight do: aBlock''
> 	iterates over the obvious rectangular grid consisting of all points p:
>
> It's not _that_ obvious.

Well, the partial order introduced by Point's <= suggests a natural
interpretation of the rectangle with upper left corner upLeft and bottom
right corner bottomRight as an ``interval'', the set of all points between
those corner points wrt <=.  The grid of all points

  upLeft = x at y <= (x+m)@(y+n) <= bottomRight  (n, m integers)

is still pretty analogous to discrete numeric intervals (left to: right).
However, Point's <= doesn't totally order (proper) rectangles, it doesn't
single out a unique natural order of traversal.  But my moral scruples
hadn't stopped me from naming the method #to:do: ...

rthappe





More information about the Squeak-dev mailing list