[squeak-dev] Basic Coding question, I do not recall seeing addressed in the literature
Eliot Miranda
eliot.miranda at gmail.com
Sun Oct 25 00:39:48 UTC 2020
Hi Timothy,
On Sat, Oct 24, 2020 at 3:32 AM gettimothy via Squeak-dev <
squeak-dev at lists.squeakfoundation.org> wrote:
> Hi Folks,
>
> Pardon the noobish "eyes of wonder" on the following.
>
> Recently, Eliot asked...
>
> what is the value of
> { (Float infinity basicAt: 1) hex.
> (Float infinity basicAt: 2) hex.
> (BoxedFloat64 infinity basicAt: 1) hex.
> (BoxedFloat64 infinity basicAt: 2) hex.
> BoxedFloat64 infinity == Float infinity }
>
> The result is:
>
>
> #('16r7FF00000' '16r0' '16r7FF00000' '16r0' true)
>
> This shows that the stuff in an Array is evaluated BEFORE the array is
> "produced".
>
These are called Array Tuples, and Dan Ingalls added them to Squeak many
years ago. They are lovely concise forms, way more convenient than Array
with: with: with: ... and not limited in size. Since Dan adding them
several dialects have followed suit. Alas we've yet to see a new edition
of the Blue Book to mention these and other great improvements (e.g.
ByteArray literals, Vassili Bykov's ifNil:ifNotNil:, closures) although I
do dream of doing a revised blue book with a modern VM specification in the
last section. And I'd love to see a Red Book on the Squeak tools.
Monticello is, for example, very beautiful, and should be more widely
praised, used, and documented.
>
> This is NOT in the Terse Guide and I do not recall seeing it in the books
> I read when I first started Squeak.
>
It should be :-)
>
> It is a very handy tool.
>
> I guess the behavior makes sense, as an Array is not a Block . Also,
> putting the same stuff in an OrderedCollection gives the same behavior.
>
>
> |x|
> x := OrderedCollection new.
> x add:(Float infinity basicAt: 1) hex.
> x add:(Float infinity basicAt: 2) hex.
> x add:(BoxedFloat64 infinity basicAt: 1) hex.
> x add:(BoxedFloat64 infinity basicAt: 2) hex.
> x add: BoxedFloat64 infinity == Float infinity .
> x inspect.
>
>
> The construct is very reminiscent of on of the early lessons in the SICP
> series,
>
>
> Anyhoo, one more cool thing to add to the toolbox.
>
> cheers.
>
>
>
--
_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20201024/9b503bdf/attachment.html>
More information about the Squeak-dev
mailing list
|