dmd codegen improvements
deadalnix via Digitalmars-d
digitalmars-d at puremagic.com
Thu Sep 3 15:48:45 PDT 2015
On Thursday, 3 September 2015 at 21:01:10 UTC, Ola Fosheim
Grostad wrote:
> On Thursday, 3 September 2015 at 13:12:07 UTC, Adam D. Ruppe
> wrote:
>> On Thursday, 3 September 2015 at 06:45:16 UTC, Jacob Carlborg
>> wrote:
>>> There's a lot of stuff other languages can do that JS can't.
>>> For example, classes, which a lot of developers prefer to use
>>> in favor of the weird object system in JS.
>
> If you don't change the prototype object, then it is mostly
> similar, but more flexible. Functions are constructors and
> prototype objects are class definitions. You could also use
> typescript, typescript playground is quite fun. It allows you
> to explore the JS output in realtime.
>
>> You can kinda do classes in JS, it just isn't pretty syntax.
>> In the D to JS toy I did, I just did an array of function
>> pointers to handle the virtual functions, similar to how D is
>> compiled to machine code.
>>
>> It'd be fairly ugly to write by hand but when converting
>> languages, it works well enough.
>
> Huh? Dynamic languages have dynamic lookup, how is that
> different from virtual functions?
Maybe because you need 2 map lookups + 1 indirection instead of
an array lookup in addition of the indirect call.
But who know, with a vectorized SSA, it surely will be faster
than light.
More information about the Digitalmars-d
mailing list