A first look - some comments
Peter Hugosson-Miller
pehu at im.se
Fri Sep 5 08:50:35 PDT 2003
Hi,
I am new on the list, just joined today, after spending the morning
browsing the Slate site. I live in Stockholm, Sweden, and am a
Smalltalker full time since mid 1995 (though in today's jobb climate
that may have to change RSN).
I must say I am very impressed with Slate, and like what I see of it so
far. I can see how polymorphic multiple dispatch could be useful, as it
could remove the need for much double-dispatching that only exists
because you can't overload method names (in Smalltalk).
In order to be sure that I followed the syntax and language semantics, I
took the demo life program from the CVS repository and translated it to
Smalltalk. I would recommend this exercise to anyone who knows Smalltalk
and is trying to get their head around Slate. It is very simple to do,
and just translating really hammers home the prototype-base philosophy,
and the need to think about who the receiver is for any given message. A
little side quest for you too: there is a method in life.slate that is
defined but never used, can you find it?
I do have one problem that I still don't really understand. On the
Syntax page http://slate.tunes.org/syntax.html about half way down in
the "Expression Sequences" section it says that "...there are no
cascaded message-sends since there is no preferred "receiver"
argument.". OK, you decided not to have cascaded message sends, but I
don't follow the reasoning as stated. For example from life.slate:
lobby addSlot: #LifeGame valued: Cloneable derive.
LifeGame addSlot: #screen.
LifeGame addSlot: #height.
LifeGame addSlot: #width.
LifeGame addSlot: #cells valued: {}. "Array of size H * W."
LifeGame addSlot: #newCells valued: {}. "Array of size H * W."
LifeGame addSlot: #randomStream.
This is almost pure Smalltalk syntax, which would normally be written
(if it were in Smalltalk) as:
lobby addSlot: #LifeGame valued: Cloneable derive.
LifeGame
addSlot: #screen;
addSlot: #height;
addSlot: #width;
addSlot: #cells valued: #(); "Array of size H * W."
addSlot: #newCells valued: #(); "Array of size H * W."
addSlot: #randomStream.
In this case, at least, the receiver is (to me) quite clear - LifeGame
is sent the messages #addSlot: and #addSlot:valued: with in the first
case a Symbol argument, and in the second a Symbol and an Array as
arguments. I must not be understanding something about the multiple
dispatch, because I can't see anything in the above preventing message
cascades from being used, like in the Smalltalk version. I think I would
miss them too, as they are so useful in init methods.
So, just my 2 cents! I'm not complaining, rather asking to be
enlightened. Thanks in advance.
--
Best regards,
Peter Hugosson-Miller
"I'll give up Smalltalk when they pry the browser from my cold, dead
fingers (or maybe when I understand Slate)!"
More information about the Slate
mailing list