raganwald/homoiconic — pull request #22 by joliss (2012-09-24 12:53:52+00:00)
Title: Fix "do" example

The first `do` in the example is redundant (and requires `methods` to be null or undefined), and the other ones don't do anything because they're not taking parameters. Instead, you need a `do (method) ->` call, analogous to the IIFE (`(function(method) { ... })(methods[i])`) in the JS code.

Here's a demo.

```coffee
class Frame

methods = null
do (methods = ['remove', 'show', 'hide', 'stop']) ->
for method in methods then do ->
Frame.prototype[method] = ->
for i in [0...1] then do ->
console.log method

(new Frame).remove() # => stop :(

methods = ['remove', 'show', 'hide', 'stop']
for method in methods
do (method) ->
Frame.prototype[method] = ->
for i in [0...1]
console.log method

(new Frame).remove() # => remove :)
```