On 2012-03-01 19:56, Alex Rønne Petersen wrote:
On 01-03-2012 19:04, Ary Manzana wrote:
3. With JS you don't have to compile and run your code (well, I guess
you could make something smart in D for that).

? The D -> JS converter just translates it. It's no different from
running e.g. the CoffeeScript compiler.

It's quite a difference. The semantics of CoffeeScript and JavaScript is more alike than D and JavaScript. CoffeeScript was created to be compile to JavaScript, not something you could say about D.

4. If you write JS you can debug it in the browser. No need to track
back to the original source code.

Valid argument. Maybe we can make the D -> JS converter help in some way
here?

Similar problem with CoffeeScript, not as bad as with D since it outputs readable JavaScript.

5. If you don't like JS syntax or verbosity, you can use CoffeeScript,
which is just a syntax rewriter, not a language/paradigm shift:
http://coffeescript.org/

Don't even get me started on the horrible "features" in CoffeeScript.
The guy who wrote the language literally had no clue what he was doing
(he admitted to reading some "make your own language" book), and it
isn't much better than JavaScript in terms of odd behavior and weird
design decisions.

It's way way WAY more better than JavaScript.

* Class based object model
* Function binding, language support for binding the this reference

If CoffeeScript had only these two features it would be so much more useful than JavaScript, but it has a lot more:

* Extremely short function/lambda syntax
* Built-in loop comprehension
* == behaves as you would expect
* Existential operator
* Default arguments
* Variadic arguments
* Object syntax
* foreach loop that actually makes sense
* Almost everything is an expression
* No need to declare variables
* Implicit returns
* No need for semicolons (yeah, I know JS have this as well but most don't seem to use this feature)
* Ranges
* Arrays slicing

6. Javascript objects have some built-in properties that are different
from D. So implementing those in D would make their performance worse
(but you can always hard-code those functions into the compiler and
translate them directly to their JS equivalent).

Can you be a little more specific here?


The good thing about writing in D is that you could probably get some
IDE for autocompletion and such. You might also like to type things
instead of using dynamic types.

To be fair, excellent JS IDEs exist already; Visual Studio has great JS
auto-completion, and ReSharper enhances it a lot too.



--
/Jacob Carlborg

Reply via email to