Version v0.6.7

7 views
Skip to first unread message

Tim Macfarlane

unread,
Mar 19, 2014, 2:45:58 PM3/19/14
to pogos...@googlegroups.com
Version v0.6.7 is out and contains a few bug fixes:

* better handling of asynchronous blocks being called without callback

The first takes a little explaining. Imagine we're making a simple web server, but it contains asynchronous calls:

http = require 'http'

wait (n)! = setTimeout (continuation, n)

server = http.createServer @(req, res)
wait (500)!
res.end ('ok')

server.listen 4000

Before v0.6.7 you’d get some weird error, saying that `res` was undefined. That’s because the block is asynchronous and it assumes the last argument is the callback, it “takes” the last argument `req` for itself and leaves it undefined for the rest of the block.

Now with v0.6.7, this script works. It checks the last argument for the presence of a function, and if present, uses it as the callback. Otherwise it leaves it alone.

* windows newlines in multiline strings are converted to unix newlines
* better support for async operations in repl

Fixed async calls and can now assign async calls to variables:

> fs = require 'fs', nil
undefined
> fs.writeFile('some.txt', 'asdf')!
undefined
> content = fs.readFile('some.txt', 'utf-8')!
'asdf'
> console.log(content)
asdf
undefined

Tim.
Reply all
Reply to author
Forward
0 new messages