Skip to content

Instantly share code, notes, and snippets.

@lucaspiller
Created July 23, 2011 14:49
Show Gist options
  • Select an option

  • Save lucaspiller/1101508 to your computer and use it in GitHub Desktop.

Select an option

Save lucaspiller/1101508 to your computer and use it in GitHub Desktop.
CoffeeScript Bug
class Model
CONST_A: 1
CONST_B: 2
CONSTS: [@CONST_A, @CONST_B]
m = new Model
# => Model
m.CONST_A
# => 1
m.CONST_A
# => 2
m.CONSTS
# => [undefined, undefined]
# Expected [1, 2]
@autotelicum

Copy link
Copy Markdown
# Workaround

show = alert # console.log

class Model
  CONST_A: 1
  CONST_B: 2

  CONSTS: [@::CONST_A, @::CONST_B]

m = new Model
# => Model
show m.CONST_A
# => 1
show m.CONST_B
# => 2
show m.CONSTS
# => [1, 2]

@lucaspiller

lucaspiller commented Jul 23, 2011 via email

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment