
On Mon, Nov 1, 2010 at 8:11 AM, Igor Stasenko <siguctua@gmail.com> wrote:
Its not a joke. I would really like to have a full smalltalk support in browser, up to placing smalltalk in <script language="smalltalk"> ....
It is great that JavaScript is prototype-based. And it is shame that its having such poor C-like syntax. What is interesting, that people exploiting a message passing with continuation and blocks-like programming style in javascript, which closely mimics smalltalk semantics.
For instance, this is an example from JQuery library:
$("div.title", wizard).each(function(index) { $(this) .next() .children(":button") .filter(".next, .previous") .click(function() { wizard.changeAccordion("activate", index + ($(this).is(".next") ? 1 : -1)) }); });
Looks familiar to us, isnt? And totally alien for C world :)
This could be easily translated to smalltalk, to something like:
(JQuery select: 'div.title') do: [:each :index | ((each next children: ':button') filter: '.next, .previous') click: [ wizard changeAccordion: ... ]
yeah.. keyword selectors require wrapping with (), to do continuation, but still, its much more clean than js code. I remember discusison about introducing a special syntax which would allow to use continuations for keyword selectors, without need of wrapping then into parethesis. So, code like:
((self foo: bar) baz: 1) jump
could be written as:
self foo: bar | baz: 1 | jump
which makes it even more clean and convenient to type, since you don't have to get back into beginning of message to put opening paren.
Hum, i'm wondering that maybe we should do more advertisement about Smalltalk to the Javascript community. Regards, -- Serge Stinckwich UMI UMMISCO 209 (IRD/UPMC), Hanoi, Vietnam Every DSL ends up being Smalltalk http://doesnotunderstand.org/