4 ms·
Apparently you have to "emulate" functions in Dart: https://www.dartlang.org/articles/emulating-functions/ https://www.dartlang.org/articles/emulating-function
by voidr 13y ago
Apparently you have to "emulate" functions in Dart:
https://www.dartlang.org/articles/emulating-functions/ https://www.dartlang.org/articles/emulating-functions/
After reading this I got the impression that Dart is yet another attempt to make the client side web accessible to Java developers who can't be bothered to learn JavaScript.
I think TypeScript is a much better attempt at making JavaScript statically analyzable, because it actually addresses concerns of existing web developers instead of just shoehorning yet another "Java runtime" in the browser.
- mraleph 13y agoYou don't have to emulate functions in Dart. Dart has first class closures: adder(x) => (y) => x + y; You can also make you objects act like functions, i.e. be callable via obj(...). Which is a completely different thing (and you can't do that in JavaScript, only functions are callable).
- kevmoo1 13y agoA profoundly disagree. Javascript is a great language, but that does not mean there is not room to improve. There is a reason tools like CoffeeScript and TypeScript (and even ASM.js) exist: there is a lot of ceremony building large applications with correct, readable Javascript. The Dart community is full of folks who have written huge amounts of Javascript and consider Dart a welcome advance. I'm a bit confused how function emulation -- useful, but certainly obscure -- could lead one to simply discard the whole project as tools for lazy Java devs.
- voidr 13y ago> A profoundly disagree. Javascript is a great language, but that does not mean there is not room to improve. Disagree with what exactly? Where did I say that JavaScript is perfect and can't be improved? On the contrary I actually said that TypeScript is a good way to improve upon JavaScript, because it actually takes into account real problems that web developers are facing and solves them. > There is a reason tools like CoffeeScript and TypeScript (and even ASM.js) exist: there is a lot of ceremony building large applications with correct, readable Javascript. There is a reason why LOLCODE exists too and I highly doubt that ASM.js code is either correct or readable, also I already mentioned TypeScript. > The Dart community is full of folks who have written huge amounts of Javascript and consider Dart a welcome advance. And if you look at it the other way around there are probably a lot more developers who have written a lot more JavaScript and dislike Dart. Arguments like these have no value. > I'm a bit confused how function emulation -- useful, but certainly obscure -- could lead one to simply discard the whole project as tools for lazy Java devs. Let me elaborate on that a bit: the fact that you have to actually emulate functions means that the language was designed for people who are used to not being able to define functions directly and think everything must be a class: Java developers. This clearly shows that the Dart designers are not even trying to play nice with JavaScript. It may seem far fetched but considering Google's GWT and Closure toolkit, you can clearly see a pattern here.