<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Here's an idea for a project (maybe for a motivated undergrad?): a Racket sub-language that, like Node.js:<div><div><br></div><div>- restricts you to only non-blocking I/O</div><div>- restricts you not to have access to Racket threads</div><div>- uses the control-flow model of JS where a single event loop invokes only one user callback at a time</div><div>- provides Node.js-like API's</div><div><br></div><div>but *also* uses send/suspend and friends to allow writing event handlers in direct style. That's something JS just can't do, since it doesn't have first-class continuations.</div><div><br></div><div>An even more ambitious student might even play with doing this in a variant of Typed Racket with an effect system, where you distinguish functions that might suspend their continuation from functions that won't, as well as effect-polymorphic higher-order functions such as map and for-each. This would make it possible to write expressive server programs where it's nonetheless still statically detectable where all the possible points of pre-emption are. This makes it easier to reason about shared state, since only calling suspendable functions can trigger a pre-emption.</div><div><br></div><div>IOW: JS control-flow model + send/suspend + Typed Racket + "suspendability" effect.</div><div><br></div><div><div>Dave</div><div><br><div><div>On Jan 14, 2011, at 9:40 AM, Neil Van Dyke wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<div bgcolor="#ffffff" text="#000000">
Eli Barzilay wrote at 01/14/2011 09:21 AM:
<blockquote cite="mid:19760.23536.638878.759482@winooski.ccs.neu.edu" type="cite">
<pre wrap="">9 hours ago, David Nolen wrote:
</pre>
<blockquote type="cite">
<pre wrap="">With a good FFI it seems like someone could write a great Racket DSL for evented network programming a la Node.js minus all the JS callback cruft.
</pre>
</blockquote>
<pre wrap=""><!---->
I know very little about it, but it looks like it covers stuff that racket includes as built in functionality.
</pre>
</blockquote>
<br>
Yeah, I don't know Node.js, but most of <a class="moz-txt-link-rfc2396E" href="http://nodejs.org/api.html">"http://nodejs.org/api.html"</a>
looks like ways to make JavaScript more easily do things that Racket
already does better than Node.js does.<br>
<br>
Regarding event-driven API like I see in the documentation for Node.js
"net.Server" documentation, you could implement that in pure Racket
pretty easily, without needing FFI.<br>
<br>
I've done some fairly high-performance I/O for TCP and interactive
subprocess pipes in pure Racket. Racket's own event conception, buffer
operations, and multithreading have been up to the task. Of course,
Racket certainly lets you implement simpler abstractions like Node.js's
atop this. You can even make Racket special-syntax like
"define-Node.js-like-server-and-with-some-static-checking". :)<br>
<br>
<div class="moz-signature">-- <br>
<a class="moz-txt-link-freetext" href="http://www.neilvandyke.org/">http://www.neilvandyke.org/</a>
</div>
</div>
_________________________________________________<br> For list-related administrative tasks:<br> <a href="http://lists.racket-lang.org/listinfo/users">http://lists.racket-lang.org/listinfo/users</a></blockquote></div><br></div></div></div></body></html>