dmd codegen improvements

Ola Fosheim Grostad via Digitalmars-d digitalmars-d at puremagic.com
Thu Sep 3 14:01:09 PDT 2015


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?


More information about the Digitalmars-d mailing list