36 points · by tosh · 11y ago · 20 comments
This feels more like an advanced compilation feature than macros which are typically used to encapsulate a set of complex operations.
Just like when a method is overridden, the reader should be able to see that there are multiple implementations and understand how they work. If you want to understand performance, you need to look at the production implementation.
Notes from last week's DEP (Dart Enhancement Proposal) Meeting https://github.com/dart-lang/dart_enhancement_proposals/blob...
Abother example is lisp, and yes lisp has the ultimate macro language (scheme, cl, clojure), and yet in Common Lisp there is the notion of "open coded" - certain builtin names are known to the compuler/interpreter and can do also magical things. That to be said certain implementations of C/C++ also have them.
The Dart VM (as well as the Observatory) are fantastic. At Blossom (https://www.blossom.co) we currently use the Dart VM for command line tools but we're looking into using it on the server side as well.
I guess you were especially interested in the performance improvements that the Dart VM could bring if it was added to Chrome? I expect that we'll also see performance improvements for dart2js as JavaScript runtimes become better compilation targets (e.g. SIMD.js, BigInt, SoundScript, …).
The interesting thing here is that the Dart team can focus on other areas like …
* the standalone Dart VM
* fletch (an experimental mobile optimized runtime)
* Observatory
* async/await
* libraries (e.g. the new `test` package)
* analyzer (used for semantic code completion & warnings and powers IntelliJ, Eclipse, Sublime, Atom (soon), DartPad see https://dartpad.dartlang.org/)
* …
and many other things in the meantime. Getting the Dart VM into Chrome and have it play nicely with v8 is not trivial.
https://github.com/dart-lang/dev_compiler
It currently targets ES6 and also comes with a more strict type checker.
Project goals:
* Effective static checking and error detection.
* A debugging solution for all modern browsers.
* Readable output.
* Fast, modular compilation of Dart code.
* Easy use of generated code from JavaScript.
There is also a nice discussion about TypeScript and Dart here: https://www.youtube.com/watch?v=5AqbCQuK0gM
I think Dart's biggest weakness is the fact that most web developers don't understand how compile to JS languages work and go around spreading all kinds of silly FUD. I remember posting a Gist on the day of Dart's release showing the compiled runtime, and the thread exploding with hundreds of comments from people laughing at the fact that it was 17,000 lines or so, nevermind the fact that that's how every compile-to-JS language that's more than a thin skin over JS semantics works.
Dart is more than 'just' a language with cleaner semantics (which is already an improvement upon TypeScript which still is closely tied to JavaScript re type coercion problems etc).
See my other posting. The Dart VM exists and can be used on the server side, for command line apps and in Dartium (fast dev cycle & debugging).
There is advanced tooling, a very clean standard library, a mobile optimized runtime, bundler inspired package management (pub), a well staffed team of people working on the analyzer and compiler toolchain and a lot of stuff surrounding "Dart the language".
Is that how it works? I just assumed it would compile to JS and just use the JS garbage collector.
Dart is a modern dynamic language. Why should it need C-like macros?
http://en.wikipedia.org/wiki/Dart_%28programming_language%29