
Interesting idea. that can remove pain in the ass! In dolphin, i've invented this expression. [self foo: bar] --> [:it| it baz: 1] --> [:it| jump] It was kind of collect: on non-collection object. But, it is very clear your idea is better. Best Regards HwaJong Oh 2010. 11. 1., 아침 10:11, Igor Stasenko 작성:
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.
-- Best regards, Igor Stasenko AKA sig.
_______________________________________________ Esug-list mailing list Esug-list@lists.esug.org http://lists.esug.org/mailman/listinfo/esug-list_lists.esug.org