JavaScript is the "VM" to target for D
Justin Johansson
no at spam.com
Tue Apr 20 05:50:51 PDT 2010
A new moon (downunder) brings time for new D discussion topic :-)
Myself having a long time interest in "webapp" development and given
that the web client platform is tied to having only JavaScript
ubiquitously available (i.e. in the browser) and having tried a zillion
OOP wrappers and frameworks for JavaScript that don't scale for
significantly-sized apps,
my current thinking seems to be aligning with others that JavaScript
should be seen as the new "binary", albeit in text form, that HLLs
should be compiling down to for "webapp" development.
Accordingly I would like to promote a discussion on the suitability of
D, perhaps even D1, as a HLL that could possibly compile down to
JavaScript as a better candidate language compared to some of the other
contenders.
To set some context for this discussion consider that GWT (Google Web
Toolkit) is basically Java transmutated into JavaScript "object code"
which is ultimately deployed on the client though development is
facilitated via a Java IDE.
Also there is Haxe, http://haxe.org/ , which reminds me of D1, it being
small and concise, and, well, rather than my words, let me copy what the
intro page says:
haXe (pronounced as hex) is an open source programming language.
While most other languages are bound to their own platform (Java to the
JVM, C# to .Net, ActionScript to the Flash Player), haXe is a
multiplatform language.
It means that you can use haXe to target the following platforms :
* Javascript : You can compile a haXe program to a single .js file.
You can access the typed browser DOM APIs with autocompletion support,
and all the dependencies are resolved at compilation time.
* Flash : You can compile a haXe program to a .swf file. haXe can
compile for Flash Players 6 to 10, with either "old" Flash<8 API or
newest AS3/Flash9+ API. haXe offers very good performance and language
features to develop Flash content.
* NekoVM : You can compile a haXe program to NekoVM bytecode. This
can be used for server-side programming such as dynamic webpages (using
mod_neko for Apache) and also for commandline or desktop applications,
since the NekoVM can be embedded and extended with some other DLL.
* PHP : You can compile a haXe program to .php files. This enable
you to use a high level strictly-typed language such as haXe while
keeping full compatibility with your existing server platform and libraries.
* C++ : You can now generate C++ code from your haXe source code,
with the required Makefiles. This is very useful for creating native
applications, for instance in iPhone development.
The idea behind haXe is to let the developer choose the best platform to
do a given job. In general, this is not easy to do because every new
platform comes with its own programming language. What haXe provides to
you is :
* a standardized language with many good features
* a standard library (including Date, Xml, Math...) that works the
same on all platforms
* platform-specific libraries : the full APIs for a given platform
are accessible from haXe
So I guess the thrust of my topic tonight is, could D somehow reinvent
itself to fame and fortune in the high-level-language-for-JavaScript space?
Cheers and beers as usual,
Justin Johansson
More information about the Digitalmars-d
mailing list