Skip to content

Instantly share code, notes, and snippets.

@lucaspiller
Created July 23, 2011 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucaspiller/1101508 to your computer and use it in GitHub Desktop.
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

# 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
Copy link
Author

lucaspiller commented Jul 23, 2011 via email

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