eclipse-archived / ceylon

The Ceylon compiler, language module, and command line tools
http://ceylon-lang.org
Apache License 2.0
395 stars 62 forks source link

Enhancement: Async via Computation Expressions #4379

Open CeylonMigrationBot opened 9 years ago

CeylonMigrationBot commented 9 years ago

[@Caementum] I'm not sure if you are working on Async at the moment or not. I though I would put this forward as a possibility.

F# has a way of defining Async expressions within the language using a feature called Computation Expressions. (https://msdn.microsoft.com/en-us/library/dd233182.aspx) What happens is that at compile time the synchronous code that you have written is transformed into a bunch of functions called by some control functions.

A side effect of this is that if Async is implemented differently in different platforms (which it is different between node.js, the browser, and vert.x) then the differing implementations can be safely written in Ceylon.

At this point writing synchronous code that works as async is the one feature I am waiting on to start using Ceylon for writing some web apps. Yes, I know I can use promises and callbacks. That does not work well with try...catch blocks or with try(resource) blocks. Using Computation Expressions the try...catch support for async can be built into the language.

[Migrated from ceylon/ceylon-spec#1273]

CeylonMigrationBot commented 9 years ago

[@gavinking] Peter I will take a look.

Sent from my iPhone

On 11 Apr 2015, at 2:11 pm, Peter Schwier notifications@github.com wrote:

I'm not sure if you are working on Async at the moment or not. I though I would put this forward as a possibility.

F# has a way of defining Async expressions within the language using a feature called Computation Expressions. (https://msdn.microsoft.com/en-us/library/dd233182.aspx) What happens is that at compile time the synchronous code that you have written is transformed into a bunch of functions called by some control functions.

A side effect of this is that if Async is implemented differently in different platforms (which it is different between node.js, the browser, and vert.x) then the differing implementations can be safely written in Ceylon.

At this point writing synchronous code that works as async is the one feature I am waiting on to start using Ceylon for writing some web apps. Yes, I know I can use promises and callbacks. That does not work well with try...catch blocks or with try(resource) blocks. Using Computation Expressions the try...catch support for async can be built into the language.

— Reply to this email directly or view it on GitHub.