Live data from Hacker News

(fab) - A pure javascript DSL for building async web apps

fabjs.org

1–10 of 27 posts

Re: (fab) - A pure javascript DSL for building async web apps

#2
Hey all,

I just launched a dead-simple web framework on top of node.js. It uses (abuses?) a lot of the dynamic nature of javascript to create a jQuery-inspired DSL that's pure javascript, allowing you to create really concise web apps like this:

  ( fab )
    ( "/time", function(){ return "the time is " + (new Date).toTimeString() } )
    ( "/date", function(){ return "the date is " + (new Date).toDateString() } )
  ( fab )
I'd love to hear any feedback from the folks here, so check it out and let me know what you think.

Re: (fab) - A pure javascript DSL for building async web apps

#3

Hey all, I just launched a dead-simple web framework on top of node.js. It uses (abuses?) a lot of the dynamic nature of javascript to create a jQuery-inspired DSL that's pure javascript, allowing you to create really concise web apps like this: ( fab ) ( "/time", function(){ return "the time is " + (new Date).toTimeString() } ) ( "/date", function(){ return "the date is " + (new Date).toDateString() } ) ( fab ) I'd…

I did a double-take looking at that syntax. I assume that fab (and all of the other bracketed expressions) return functions that chain together? Pretty ingenious. Plus you can detect the end of the chain when one of the methods is passed in "fab" again.

I think I can say that this is the best (ab)use of the syntax I've ever seen, well done. :)

Re: (fab) - A pure javascript DSL for building async web apps

#4
post #3

Hey all, I just launched a dead-simple web framework on top of node.js. It uses (abuses?) a lot of the dynamic nature of javascript to create a jQuery-inspired DSL that's pure javascript, allowing you to create really concise web apps like this: ( fab ) ( "/time", function(){ return "the time is " + (new Date).toTimeString() } ) ( "/date", function(){ return "the date is " + (new Date).toDateString() } ) ( fab ) I'd…

I did a double-take looking at that syntax. I assume that fab (and all of the other bracketed expressions) return functions that chain together? Pretty ingenious. Plus you can detect the end of the chain when one of the methods is passed in "fab" again. I think I can say that this is the best (ab)use of the syntax I've ever seen, well done. :)

Yeah, a (fab) function just returns itself. It's like jQuery's chaining, but using argument signatures instead of object methods to delegate work. The last (fab) is just a way to indicate the chain is over so that a listener can be returned, and has the additional benefit of making it look declarative.

Re: (fab) - A pure javascript DSL for building async web apps

#5

Hey all, I just launched a dead-simple web framework on top of node.js. It uses (abuses?) a lot of the dynamic nature of javascript to create a jQuery-inspired DSL that's pure javascript, allowing you to create really concise web apps like this: ( fab ) ( "/time", function(){ return "the time is " + (new Date).toTimeString() } ) ( "/date", function(){ return "the date is " + (new Date).toDateString() } ) ( fab ) I'd…

The syntax looks cute for one-lined request handler functions. I wonder how it stacks up for larger, multi-line functions. Heck, you're pretty close to sexps (I kid!).

Re: (fab) - A pure javascript DSL for building async web apps

#6
post #5

Hey all, I just launched a dead-simple web framework on top of node.js. It uses (abuses?) a lot of the dynamic nature of javascript to create a jQuery-inspired DSL that's pure javascript, allowing you to create really concise web apps like this: ( fab ) ( "/time", function(){ return "the time is " + (new Date).toTimeString() } ) ( "/date", function(){ return "the date is " + (new Date).toDateString() } ) ( fab ) I'd…

The syntax looks cute for one-lined request handler functions. I wonder how it stacks up for larger, multi-line functions. Heck, you're pretty close to sexps (I kid!).

It's vaguely lispy, but without all that nesting.

Multi-line functions work okay, but it's definitely cleaner to name them and put them somewhere else so that your code ends up looking like a site map:

http://gist.github.com/287475#file_hello_middleware.js

Re: (fab) - A pure javascript DSL for building async web apps

#9
Stuff like (fab) and CoffeeScript* show how easy it is to build on top of the V8 and node.js platform. And these toy languages/frameworks also have great perfomance given the non-blocking nature of node.js and the optimizations of V8. Amazing and happy to see more of these projects :)

* http://jashkenas.github.com/coffee-script/

Re: (fab) - A pure javascript DSL for building async web apps

#10
post #7

Unfortunate name: The Fabric Python deployment tool uses the fab binary and uses fab files for configuring deployments: http://docs.fabfile.org/

Why should a javascript library defer to the abbreviated name of a minor python-land command line tool?
Post reply on HN