How Nested Functions Work, part 2

Jeremie Pelletier jeremiep at gmail.com
Mon Sep 21 12:07:47 PDT 2009


language_fan wrote:
> Mon, 21 Sep 2009 13:17:38 -0400, Jeremie Pelletier thusly wrote:
> 
>> Justin Johansson wrote:
>>> bearophile Wrote:
>>>
>>>> - Currently D isn't very useful for the web/mobile, where lot of
>>>> programmers are.
>>> I'd be interested to know how good D is for implementing
>>> scripting/dynamic languages .. maybe that could change the odds?  I
>>> know about DMDScript (ECMAScript in D) supposedly being fast, though
>>> whatever I've read is no doubt out of date as Javascript engine
>>> (performance) wars between Google (webkit) and Mozilla (spidermonkey?)
>>> engines have been raging as of late.
>>>
>>>
>> It is definitely easier to implement scripting languages in D than it is
>> in other languages such as C/C++. However where I believe V8 (google's
>> JS engine) is gaining in performance is at the direct translation of
>> parse nodes to assembly without using intermediate representation in
>> between and without the need of an interpreter, they even go as far as
>> to modify code paths dynamically to gain more performance. I hear
>> mozilla rewrote their JS engine lately too but didn't check what
>> improvements they made.
> 
> When implementing a scripting language VM, it does not really matter if 
> you use C, C++, D, Ada, Eiffel, Pascal, Obj-C, Haskell or OCaml (or any 
> of the top15 languages in the great language shootout). They all are 
> pretty fast. The fact is, if you have studied CS and know mechanisms like 
> dynamic translation, generational garbage collection, or region 
> inference, you can build a fast scripting language VM in any decent 
> language. D is in no way special here. In fact it is not even hard to 
> make the fastest Javascript VM in the world with D - the current ones are 
> not very good.

Studying CS has nothing to do with how competent you are, period. The 
number of languages and algorithms a guy can name has no relevance 
either. It can help to get you started, but anyone with enough interest 
in programming can learn much more on their own and in much less time. 
Sorry for the rant, I'm just tired of seeing CS thrown around as an 
argument.

When it comes to writing scripting engines, with IR running in a VM or 
generated machine code, the language used is really just a matter of 
preference, it will affect productivity way more than performance, if 
the code is properly done. That's what I meant by easier to do in D, 
you'll have way less lines of code than in C/C++ or most other systems 
languages.

Now its only obvious that things like garbage collection and whatnot are 
required to be familiar to the programmer implementing it, no need to go 
to CS to know that :)



More information about the Digitalmars-d mailing list