chrisdotcode
For clarification, the error is handled implicitly (but you'd know what kind of error it was due to the type signature), but you can always handle it in manner you choose to at any point.
images <- get "http://example.com/images.json"
is objectively easier to reason about than: var images;
get("http://example.com/images.json", (err, resp) =>
if err throw err;
images = resp;
even though the former might be internally implemented as the latter.In addition, the former doesn't give the programmer the 'opportunity' to cause a race-condition, and encapsulates the failure entirely for you (automatically and defaultly); If `images` ends up erroring, and you use it again, then it'll short-circuit without crash, very similar to `then()`.
Excluding the singleton class (which could have been a single function itself), you've got your map/filters in the gif processing, and encapsulation of async activities[0] through monads via promises.
Seems like JavaScript got good when it started embracing what functional programmers have been drowned out saying for years.
Looking good indeed.
[0] Async actions as a language-level construct, as opposed to a syntactic abstraction have always been A Bad Idea. Promises should have always been the default, and manually writing callbacks should have never been a thing.
I would not call that building a compiler.
Are there any modern tutorials/references of hand-generating the grammar, hand-coding the parser, and hand-coding whatever comes next (because I have no idea, thanks to these new-age tutorials) - without a toolchain, so that the entire process can be seen from start to finish?
[0] - http://patriciopalladino.com/blog/2012/08/09/non-alphanumeri...
All Megaupload Data Has Been Deleted
Massive Number of Vulnerabilities Found in X.Org
Stackoverflow has serious problems.
[1] http://stackoverflow.com/questions/15429479/obfuscated-c-cod...