JavaScript is the "VM" to target for D

Nick Sabalausky a at a.a
Tue Apr 20 18:18:45 PDT 2010


"Justin Johansson" <no at spam.com> wrote in message 
news:hqk7ve$2ouj$1 at digitalmars.com...
>
> 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.
>
>
> 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:
>

I believe *very* strongly in using a REAL language that then gets compiled 
down to worthless crap like PHP, ActionScript, etc., whenever such worthless 
crap platforms are necessary. Which is, of course, necessary FAR too often 
when you do web development, as I do.

I use Haxe for any and all PHP and Flash development and I will *never* go 
back to direct PHP or ActionScript. Never, ever, ever, ever, EVER! PHP in 
particular is by far the absolute worst, most pathetic language *and* 
platform (PHP's idiocy extends far beyond the language itself) ever 
conceived and actually used in the real world (Ok, I'm not counting old 
mainframes). ActionScript2 and the Flash8 API are barely any better (and 
unfortunately, if you want *real* compatibility, AS3/Flash9 aren't really as 
much of an option as all the kiddie trend-whores that have infected the 
programming world like the pretend.) So yea, count me as one person who does 
go the Haxe route (including HaxeIgniter), swears by it (quite literally, as 
you can see ;) ), and will *never* look back.

D, or at least something closer to D, would be FAR better than Haxe, though. 
In fact even though I just raved about Haxe, I actually hate Haxe. Yes, it's 
vastly superior to using direct PHP/AS, so much so that IMO there's no good 
reason ever to use PHP/AS directly. But Haxe is still crap anyway. Just off 
the top of my head, and I know I'm forgetting a lot:

- The documentation is god-awful.

- The allegedly-strong type system has one hell of a blatant and idiotic 
hole that probably won't get fixed: 
http://code.google.com/p/haxe/issues/detail?id=105

- Haxe has no real metaprogramming, and it's "generics" make C#'s gimped 
generics ( 
http://blog.dev-scene.com/abscissa/2008/03/10/i-want-my-iarithmetic/ ) look 
practically super-powered. (Granted, at least you can add two generic types 
in Haxe unlike C#, but in other ways they really are very, very limited.)

- The syntax for defining properties is absolutely horrid, and will cause 
severe optical hemorrhaging in anyone who values DRY. Although, Java-type 
people who enjoy seeing how many millions of lines of useless boilerplate 
garbage their IDE can spit out while still accomplishing practically nothing 
will probably love it.

- Everything must be in a class (or an enum)...for no apparent reason other 
than, apparently, to ape Java (and why anyone would ever want to ape Java is 
beyond me).

- There are a lot of PITA PHP idiosyncrasies that Haxe doesn't really shield 
you from. (Example: Some dumbass sysadmin decided your PHP5 installation 
should have magic quotes enabled by default? You, as the app developer, 
still have to work around it. Haxe theoretically could automatically add 
code that detects and reverses it as best as possible. But it doesn't.)

- I'm beginning to question the sanity of the guy in charge: 
http://code.google.com/p/haxe/issues/detail?id=106 (He blatantly breaks 
basic browser behavior for quite obviously no benefit whatsoever, he's 
spoon-fed a trivial fix, and...he passes it off as a user issue? WTF? 
Granted, it's not a major issue, but seriously, the lack of logic involved 
in coming to a conclusion like that just stuns me.)

But yea, while Haxe has its issues, I'm still a huge proponent of the idea 
of compiling real languages does to the garbage ones when you're forced to 
use a garbage one. In fact, my Goldie project ( 
www.dsource.org/projects/goldie ) has that sort of thing as one of it's 
original motivating factors and one of its ultimate goals.

However, I'm not convinced that compiling a full real language down to 
browser-client-JavaScript is a great idea...

For one thing, something like that is going to have overhead (and JS is 
sluggish enough already), unless it goes the Haxe route and actually designs 
the language around the idea of very easy/direct translation to the base 
language, which of course, limits how much of an improvement the new 
language can actually be.

The other issue I have with it is that I feel *VERY* strongly that 
JavaScript should *only be used sparingly*. Specifically, any web app 
*should* be designed and built from the start without any use of JavaScript 
whatsoever. This is possible 99.99% of the time (In fact, most of the times 
people think they need JS for something, they're full of crap. Like button 
rollover images, for instance: CSS handles rollover images FAR better than 
any JS engine ever will.) *Then* and *only* then, you can toss in little 
snippets of optional JS here and there to clean up various things for people 
who choose to have JS enabled. I know I'm in the minority on this, but I 
feel very strongly that that's the *only* good way to design a web app, 
anything else is just plain crap design. (Correction: there's no such thing 
as a good way to design a web app, because "good web app" is a blatant 
contradiction of terms since the web is an absolute shit platform for 
applications *period*. (/me waits for Adam Ruppe's DWS with baited breath 
:) ) So I guess I should have said that's the *closest* it can possibly get 
to being a "good" way to design a web app.)

Whew!
...
Can you tell I've been itching to get all that off my chest for quite some 
time? ;)





More information about the Digitalmars-d mailing list