NodeJs is a big opportunity for haXe

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

NodeJs is a big opportunity for haXe

sledorze
Recently, I've been some work on externs for various javascript based nodeJs API.

Man!, from flaws and lack of consistency in many of them (including really famous one) I came to the conclusion that using advanced static typing (enum exhaustivity checks ) and inlining optimizations could make haXe a way more efficient tool for crafting high performance and very robust code instead of direct javascript.


I think however that Js people won't switch for new libraries, they would switch first because it is easier for them to use their beloved modules.


Thanks to the fact that haXe is compiled, it can evolve beyond javascript limitations and brings something on the table even when using existing modules.

I am thinking about the first motivation for them to try and love it (and am also directly inspired by a personnal frustration..).

This motivation ould be to solve the callback hell and terminaison garantees (read, correctly handling failure scenario in meaningful ways).

The callback hell make a lot of them switch to coffeescript because it is less complicated to read, but this does not fundamentally solve it, it removes some ceremony but the hell is still there.

I am clearly thinking about Promise / Future abstractions (or PI calculus if you want to go this road).

Today, however, writing those requiers one to accept a non trivial runtime overhead and an heavy syntax (personnal taste perhaps).
Comprehensions would help I really think.. (not a macro one where you loose completion, it would remove the magic of the speedy compiler .. I am speaking about native support, nothing less)

I really think haXe could repeat the polygonal story in a JS environment specifically one closer to system programming..

What do you think about that?,
Stephane
Reply | Threaded
Open this post in threaded view
|

Re: NodeJs is a big opportunity for haXe

Cauê W.
Hey Stephane! Great input!

 The callback hell make a lot of them switch to coffeescript because it is
less complicated to read, but this does not fundamentally solve it, it
removes some ceremony but the hell is still there.

 

About callbacks, Nicolas said at haxecon he was thinking about making an 'async' keyword that would automatically transform the function call into a function call + callback to the rest of the function.

This would be the perfect solution.

I was working before that on a macro-enabled way to deal with coroutines that could also provide a solution. I stopped working on that because of the async keyword, but it's only missing a couple of touches to make it useful. I can take some time to finish it, if you think there is the possibility to use it as a selling point for haxe-js

Cheers!
Cauê

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: NodeJs is a big opportunity for haXe

sledorze
Cool,

Nicolas, will you plan to implement it as a delimited continuation? (shift / reset)


One very annoying stuff in nodeJs is when you want to access several async services; people tend to nest the differents access making those happend one after the other even if the latter call does not depend of the result of the former.

Writing really concurrent code is so not very effective due to the lack of support of the language (or effort to make it happen using librairies).

Ideally when accessing several independant services to grab some datas from them and then do something with it should really take advantage of the concurrent nature of node and be parallel.

Language support to make that natural could make just the comparison with current nodeJs showcases ridiculous..





2011/10/14 Cauê W. [via Haxe] <[hidden email]>
Hey Stephane! Great input!

 The callback hell make a lot of them switch to coffeescript because it is
less complicated to read, but this does not fundamentally solve it, it
removes some ceremony but the hell is still there.

 

About callbacks, Nicolas said at haxecon he was thinking about making an 'async' keyword that would automatically transform the function call into a function call + callback to the rest of the function.

This would be the perfect solution.

I was working before that on a macro-enabled way to deal with coroutines that could also provide a solution. I stopped working on that because of the async keyword, but it's only missing a couple of touches to make it useful. I can take some time to finish it, if you think there is the possibility to use it as a selling point for haxe-js

Cheers!
Cauê

--
haXe - an open source web programming language
http://haxe.org


If you reply to this email, your message will be added to the discussion below:
http://haxe.1354130.n2.nabble.com/NodeJs-is-a-big-opportunity-for-haXe-tp6892913p6892970.html
To unsubscribe from NodeJs is a big opportunity for haXe, click here.



--
Stéphane Le Dorze


Reply | Threaded
Open this post in threaded view
|

Re: NodeJs is a big opportunity for haXe

Cauê W.
Stephane, I don't know when the implementation of async in haxe is intended for, if you'd like to help me figure out the right syntax for this macro we can figure something out that's good for node.js (never worked with node.js)

The basic idea comes from C#'s yield keyword, which makes it possible (though in C# in a very insecure way) to implement coroutines and state recovery inside a function. We can expand this concept even to handle try/catch blocks in a way supported by how node.js defaults error handling (i have no idea how they default it, though)

2011/10/14 sledorze <[hidden email]>
Cool,

Nicolas, will you plan to implement it as a delimited continuation? (shift / reset)


One very annoying stuff in nodeJs is when you want to access several async services; people tend to nest the differents access making those happend one after the other even if the latter call does not depend of the result of the former.

Writing really concurrent code is so not very effective due to the lack of support of the language (or effort to make it happen using librairies).

Ideally when accessing several independant services to grab some datas from them and then do something with it should really take advantage of the concurrent nature of node and be parallel.

Language support to make that natural could make just the comparison with current nodeJs showcases ridiculous..





2011/10/14 Cauê W. [via Haxe] <[hidden email]>
Hey Stephane! Great input!

 The callback hell make a lot of them switch to coffeescript because it is
less complicated to read, but this does not fundamentally solve it, it
removes some ceremony but the hell is still there.

 

About callbacks, Nicolas said at haxecon he was thinking about making an 'async' keyword that would automatically transform the function call into a function call + callback to the rest of the function.

This would be the perfect solution.

I was working before that on a macro-enabled way to deal with coroutines that could also provide a solution. I stopped working on that because of the async keyword, but it's only missing a couple of touches to make it useful. I can take some time to finish it, if you think there is the possibility to use it as a selling point for haxe-js

Cheers!
Cauê

--
haXe - an open source web programming language
http://haxe.org


If you reply to this email, your message will be added to the discussion below:
http://haxe.1354130.n2.nabble.com/NodeJs-is-a-big-opportunity-for-haXe-tp6892913p6892970.html
To unsubscribe from NodeJs is a big opportunity for haXe, click here.



--
Stéphane Le Dorze


Tel: <a href="tel:%2B33%20%280%29%206%2008%20%C2%A076%2070%2015" value="+33608767015" target="_blank">+33 (0) 6 08  76 70 15




View this message in context: Re: NodeJs is a big opportunity for haXe

Sent from the Haxe mailing list archive at Nabble.com.

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: NodeJs is a big opportunity for haXe

Justin Donaldson-3
Here's an approach I use for asynchronous operations:
https://github.com/jdonaldson/sugar-async

I have an experimental version there that works with threads (cpp and neko), but it still has a long ways to go.

Best,
-Justin

On Fri, Oct 14, 2011 at 10:06 AM, Cauê Waneck <[hidden email]> wrote:
Stephane, I don't know when the implementation of async in haxe is intended for, if you'd like to help me figure out the right syntax for this macro we can figure something out that's good for node.js (never worked with node.js)

The basic idea comes from C#'s yield keyword, which makes it possible (though in C# in a very insecure way) to implement coroutines and state recovery inside a function. We can expand this concept even to handle try/catch blocks in a way supported by how node.js defaults error handling (i have no idea how they default it, though)


2011/10/14 sledorze <[hidden email]>
Cool,

Nicolas, will you plan to implement it as a delimited continuation? (shift / reset)


One very annoying stuff in nodeJs is when you want to access several async services; people tend to nest the differents access making those happend one after the other even if the latter call does not depend of the result of the former.

Writing really concurrent code is so not very effective due to the lack of support of the language (or effort to make it happen using librairies).

Ideally when accessing several independant services to grab some datas from them and then do something with it should really take advantage of the concurrent nature of node and be parallel.

Language support to make that natural could make just the comparison with current nodeJs showcases ridiculous..





2011/10/14 Cauê W. [via Haxe] <[hidden email]>
Hey Stephane! Great input!

 The callback hell make a lot of them switch to coffeescript because it is
less complicated to read, but this does not fundamentally solve it, it
removes some ceremony but the hell is still there.

 

About callbacks, Nicolas said at haxecon he was thinking about making an 'async' keyword that would automatically transform the function call into a function call + callback to the rest of the function.

This would be the perfect solution.

I was working before that on a macro-enabled way to deal with coroutines that could also provide a solution. I stopped working on that because of the async keyword, but it's only missing a couple of touches to make it useful. I can take some time to finish it, if you think there is the possibility to use it as a selling point for haxe-js

Cheers!
Cauê

--
haXe - an open source web programming language
http://haxe.org


If you reply to this email, your message will be added to the discussion below:
http://haxe.1354130.n2.nabble.com/NodeJs-is-a-big-opportunity-for-haXe-tp6892913p6892970.html
To unsubscribe from NodeJs is a big opportunity for haXe, click here.



--
Stéphane Le Dorze


Tel: <a href="tel:%2B33%20%280%29%206%2008%20%C2%A076%2070%2015" value="+33608767015" target="_blank">+33 (0) 6 08  76 70 15




View this message in context: Re: NodeJs is a big opportunity for haXe

Sent from the Haxe mailing list archive at Nabble.com.

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: NodeJs is a big opportunity for haXe

Nicolas Cannasse
In reply to this post by sledorze
Le 14/10/2011 18:18, sledorze a écrit :
> Cool,
>
> Nicolas, will you plan to implement it as a delimited continuation?
> (shift / reset)

I will have to look again at the different possibilities of async
programming. I think than with compiler changes made in 2.08 we can make
much more highlevel transformations such as CPS in a fully crossplatform
manner.

We also have to find proper syntax/semantics.

I'm for example interested in features that permit to use a given
existing async API, such as :

function doSomething( result : Int -> Void ) : Void;

In a more synchronized manner, for instance :

var x = async doSomething();
var y = async doSomething();
return x + y;

Of course this is not as easy as it seems. In particular you might want
to be able to spawn both "doSomething" calls in parallel and not
sequentially so it's not like you're doing only CPS transformation but
something like futures.

I welcome people interested in the topic to create a wiki page on
haxe.org (or somewhere else) in order to exchange ideas for the
different possibilities.

Best,
Nicolas

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: NodeJs is a big opportunity for haXe

sledorze
You can count on me, i am really eager to help on this particular topic!!!!

Sent from my iPhone

On 14 oct. 2011, at 21:02, "Nicolas Cannasse [via Haxe]" <[hidden email]> wrote:

Le 14/10/2011 18:18, sledorze a écrit :
> Cool,
>
> Nicolas, will you plan to implement it as a delimited continuation?
> (shift / reset)

I will have to look again at the different possibilities of async
programming. I think than with compiler changes made in 2.08 we can make
much more highlevel transformations such as CPS in a fully crossplatform
manner.

We also have to find proper syntax/semantics.

I'm for example interested in features that permit to use a given
existing async API, such as :

function doSomething( result : Int -> Void ) : Void;

In a more synchronized manner, for instance :

var x = async doSomething();
var y = async doSomething();
return x + y;

Of course this is not as easy as it seems. In particular you might want
to be able to spawn both "doSomething" calls in parallel and not
sequentially so it's not like you're doing only CPS transformation but
something like futures.

I welcome people interested in the topic to create a wiki page on
haxe.org (or somewhere else) in order to exchange ideas for the
different possibilities.

Best,
Nicolas

--
haXe - an open source web programming language
http://haxe.org



If you reply to this email, your message will be added to the discussion below:
http://haxe.1354130.n2.nabble.com/NodeJs-is-a-big-opportunity-for-haXe-tp6892913p6893700.html
To unsubscribe from NodeJs is a big opportunity for haXe, click here.
Reply | Threaded
Open this post in threaded view
|

Re: NodeJs is a big opportunity for haXe

sledorze
In reply to this post by Cauê W.
I think enumeratee are really a More general and usefull computation model and may eventualy be considered. However nodejs typical computations are more like futures / promises. I am also best interested in réactive paradigm. All those being différent computationnal models, each best for a particular use case.


Sent from my iPhone

On 14 oct. 2011, at 19:08, Cauê W. [via Haxe] <[hidden email]> wrote:

Stephane, I don't know when the implementation of async in haxe is intended for, if you'd like to help me figure out the right syntax for this macro we can figure something out that's good for node.js (never worked with node.js)

The basic idea comes from C#'s yield keyword, which makes it possible (though in C# in a very insecure way) to implement coroutines and state recovery inside a function. We can expand this concept even to handle try/catch blocks in a way supported by how node.js defaults error handling (i have no idea how they default it, though)

2011/10/14 sledorze <[hidden email]>
Cool,

Nicolas, will you plan to implement it as a delimited continuation? (shift / reset)


One very annoying stuff in nodeJs is when you want to access several async services; people tend to nest the differents access making those happend one after the other even if the latter call does not depend of the result of the former.

Writing really concurrent code is so not very effective due to the lack of support of the language (or effort to make it happen using librairies).

Ideally when accessing several independant services to grab some datas from them and then do something with it should really take advantage of the concurrent nature of node and be parallel.

Language support to make that natural could make just the comparison with current nodeJs showcases ridiculous..





2011/10/14 Cauê W. [via Haxe] <[hidden email]>
Hey Stephane! Great input!

 The callback hell make a lot of them switch to coffeescript because it is
less complicated to read, but this does not fundamentally solve it, it
removes some ceremony but the hell is still there.

 

About callbacks, Nicolas said at haxecon he was thinking about making an 'async' keyword that would automatically transform the function call into a function call + callback to the rest of the function.

This would be the perfect solution.

I was working before that on a macro-enabled way to deal with coroutines that could also provide a solution. I stopped working on that because of the async keyword, but it's only missing a couple of touches to make it useful. I can take some time to finish it, if you think there is the possibility to use it as a selling point for haxe-js

Cheers!
Cauê

--
haXe - an open source web programming language
http://haxe.org


If you reply to this email, your message will be added to the discussion below:
http://haxe.1354130.n2.nabble.com/NodeJs-is-a-big-opportunity-for-haXe-tp6892913p6892970.html
To unsubscribe from NodeJs is a big opportunity for haXe, click here.



--
Stéphane Le Dorze


Tel: <a href="tel:%2B33%20%280%29%206%2008%20%C2%A076%2070%2015" value="+33608767015" target="_blank">+33 (0) 6 08  76 70 15




View this message in context: Re: NodeJs is a big opportunity for haXe
--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org


If you reply to this email, your message will be added to the discussion below:
http://haxe.1354130.n2.nabble.com/NodeJs-is-a-big-opportunity-for-haXe-tp6892913p6893282.html
To unsubscribe from NodeJs is a big opportunity for haXe, click here.
Reply | Threaded
Open this post in threaded view
|

Re: NodeJs is a big opportunity for haXe

sledorze
In reply to this post by Justin Donaldson-3
I've read it, that's an interesting project.

I invite you to take a look at the reactive api of stax which takes a functional approach to this, bringing also more expressivity (Events and Signals) which both are real monads.
https://github.com/jdegoes/stax/tree/master/src/main/haxe/haxe/reactive

The advantage being that you build by combining declarative functions (no need to look inside functions to understand the flow).

a small example extracted from a personnal projet:

var lastSelectionFrame =
        selection.changes().unique().snapshot(frames).startsWith(frames.valueNow());

selection is a signal.
selection.changes() is an event.
selection.changes().unique() filters to keep an event stream of changing (different) values.
snapshot capture the frames signal at each event change and return a event stream of the frames.
startsWith creates a continuous signal from an event and a first value.

etc..
I invite you to dive in; it implements cleanly the general concepts of the reactive paradigm.


Not to mention Stax is a wonderful but heavy library for small footprint projects, so if your solution best fits your needs, stick to it! ;)

Stéphane
Reply | Threaded
Open this post in threaded view
|

Re: NodeJs is a big opportunity for haXe

sledorze
In reply to this post by Nicolas Cannasse
I've started something..

http://haxe.org/com/incubator/async?lang=en

Feel free to alterate :)
Reply | Threaded
Open this post in threaded view
|

Re: NodeJs is a big opportunity for haXe

sledorze
I m not happy with that in fact, it looks just like a big hack to bring a feature, i Will propose something else..

Sent from my iPhone

On 16 oct. 2011, at 01:39, "sledorze [via Haxe]" <[hidden email]> wrote:

I've started something..

http://haxe.org/com/incubator/async?lang=en

Feel free to alterate :)


If you reply to this email, your message will be added to the discussion below:
http://haxe.1354130.n2.nabble.com/NodeJs-is-a-big-opportunity-for-haXe-tp6892913p6896725.html
To unsubscribe from NodeJs is a big opportunity for haXe, click here.
Reply | Threaded
Open this post in threaded view
|

Re: NodeJs is a big opportunity for haXe

sledorze
I've put more thoughts (and remove some no more relevants).