Re:Visual Basic, PHP, Rails. Is Node.js next?
by wahnfrieden on Sunday April 01, 2012 @09:09PM
(#3785711)
Ah yea - so it's not impossible, it just makes typical usage overly cumbersome. Maybe this is something a coffeescript extension or analog could help solve.
[ Parent
| on HN ]
Re:Visual Basic, PHP, Rails. Is Node.js next?
by roryokane on Sunday April 01, 2012 @11:05PM
(#3786084)
Yes, there is already a CoffeeScript fork that makes asynchronous code less cumbersome by making it look like synchronous code. It's called IcedCoffeeScript and is at http://maxtaco.github.com/coffee-script/.
Re:Visual Basic, PHP, Rails. Is Node.js next?
by olalonde on Sunday April 01, 2012 @09:18PM
(#3785740)
Well, it is impossible to transparently lazy load from a database. CoffeeScript won't solve the problem since it is still ultimately limited by Node.js' async libraries.
A "solution" would be to cheat and write a sync database API but then, you would break the assumption that everything is async with Node.js, making it harder to work with other programmers or use third party modules.
Re:Visual Basic, PHP, Rails. Is Node.js next?
by xtrumanx on Sunday April 01, 2012 @11:15PM
(#3786116)
> CoffeeScript won't solve the problem since it is still ultimately limited by Node.js' async libraries.
I wouldn't be too sure about that. .net 4.5 is coming out with an await and async keywords which will basically signal to the compiler that method should be re-written to an asynchronous. So for the example you gave, if the await keyword was available in coffeescript, you could just write:
await console.log(user.referrer.name);
And the coffeescript compiler could then re-write callback style.
Re:Visual Basic, PHP, Rails. Is Node.js next?
by roryokane on Monday April 02, 2012 @12:20AM
(#3786301)
In fact, IcedCoffeeScript (http://maxtaco.github.com/coffee-script/) already implements this, using keywords called "await" and "defer".