small medium large xlarge

Back to: All Forums  CoffeeScript
Mark1_pragsmall
05 Aug 2011, 19:10
R. Mark Volkmann (13 posts)

On the top of page 72 in the book (end of section 4.5), why are there braces around the names to the left of the assignment? For example: {Dictionary} = require ‘./Dictionary’

Is that something specific to Node.js?

Trevor_burnham__goofy_headshot__pragsmall
05 Aug 2011, 23:41
Trevor Burnham (54 posts)

It’s shorthand for @Dictionary = (require ‘./Dictionary’).Dictionary@. I talk briefly about the syntax (and how useful it is with Node’s @require@) in section 3.6, “Pattern Matching.”

I also show off the syntax in my May PragPub article “A CoffeeScript Intervention”: http://pragprog.com/magazines/2011-05/a-coffeescript-intervention

You must be logged in to comment