On Wednesday, 29 February 2012 at 09:27:53 UTC, Robert Clipsham wrote:
Pretty impressive! It did spit out 86 warnings though...

A lot of it is probably the same kind of thing my
"linker" does. (I call it that, but it doesn't actually
*link* anything.)

I get down to 6 KB running it through that. Though, they
still cut it in half and there's some code rewriting in there
too. Not bad.


Fun fact btw: dmd -inline works on this thing too. Though,
inline makes a bunch of stuff in the form of (var a = 10, etc)
which is illegal in JS (and D, actually).


To hack that so it worked, I simply left the var out, so it
uses an implicit global variable. The D mangled names are unique
so I think it will work in practice, but still, blah.


Regardless, inlining functions is pretty cool. Might make
things bigger however, so idk if it is actually worth it.

 * JSC_WRONG_ARGUMENT_COUNT
 * JSC_REDECLARED_VARIABLE

I threw it a bone to silence some of these,
but much of it isn't actually wrong so meh.

But these:

 * JSC_USED_GLOBAL_THIS
 * JSC_NOT_A_CONSTRUCTOR

don't help at all. Even if I add the /**@constructor*/,
it just spits even more unhelpful warnings.

http://arsdnet.net/dtojs/test2.js

is where I put it. (the size there is tiny because I left
a lot of dead code in there; I just put a return; before my
other test code.)

JSC_TYPE_MISMATCH: actual parameter 1 of __d_6Object.call does not match formal parameter
found   : __d_6microd6MyBase
required: (__d_6Object|null|undefined) at line 2 character 17 in test2.js__d_6Object.call(this, null); ^ JSC_INEXISTENT_PROPERTY: Property __d_vtbl never defined on __d_6microd6MyBase at line 3 character 0 in test2.jsthis.__d_vtbl.length = 3;


I call the Object initalizer (this isn't a constructor in D. The
real D compiler would just blit the Object.init to get the memory
started. The D constructor is passed as an argument to be called
at the end.) to set up that vtable.


So, I know its all right, but it is going to warn anyway.

Good work at getting std.algorithm (mostly) working! :D

Thanks!

Reply via email to