Hi!
On 07/06/2012 11:25 AM, Herby Vojčík wrote:
> Göran Krampe wrote:
>> It turns out they do a really dirty trick - and we are unsure about how
>> it will scale when compiling a larger Dart app to js. If there is a Dart
>> guru lurking, please give us more info. After a "cursory look" it seems
>> they take *all message sends* in your app (you know, that can be a
>> fairly long list) and implement *all* of them in the base prototype in
>> js as "return this.noSuchMethod();"-kinda. Hehe, what a hack! Clever,
>> but... hm.
>
> Well, without knowing it is done this way in Dart, I proposed this
> solution myself to Nicolas over irc... so more people think it is not
> such a bad idea...
Yeah, ok, when I wrote "really dirty trick" and "what a hack" I actually
meant that it was "sneaky/funny" and not actually bad. Given whatever
constraints we have to work with - it obviously is one way of doing
these things.
>> And yeah, it also means it only works for messages that are known to be
>> sent at compile time - in other words, sure, you do have a working DNU,
>> but you sure don't have #perform:. We are also unsure about how they
>> produce that list, do they support all messages my app sends, or all
>> messages my app and all the libraries I use sends? Not sure.
>
> Perform: I see no problem doing this in Amber so that it works the both
> way. Shortcut the "known" method sends, and "interpret/compute/simulate"
> the unknown ones. Of course, I would never propose such a trick if the
> side-effect would be cutting perform: away.
>
> In Amber, this list is easy to produce: whenever you load a method, it
> contains (and should in .deploy as well) the list of sent selectors.
...but (forgive me from being dense) what do you gain with these
shortcuts? I mean, we still do the lookup machinery ourselves, don't we?
AFAICT the whole point in Dart is to NOT do lookups yourself and instead
rely on js (and thus speed).
regards, Göran