New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CoffeeScript classes supported? #26
Comments
An unfortunate and glaring omission, we don't have explicit grammar support for putting contracts on classes yet. I really should have added them before, it's now at the top of my stack. Interestingly enough, your first example of putting a whole contract on the class should have worked since |
Thats a pity as my app is OO and classes was first place where i wanted to put the contracts. I'll be looking forward for them. Thanks for a great library and idea. It'll be really powerful once used. BTW tested on node 0.7.0 and 0.5.10, same results. |
After deeper checking there an issue with two things here:
Changing NodeAddr to Any makes it all passing and class is initialized correctly. |
Interesting...
This is definitely a bug. The |
I needed to use ==> because -> doens't trigger options.newSafe, thanks to which proxy returns new instance instead of a return value of the constructor. Additionally, to have a class contracted fully, you have to do 2 things:
# TServer is a contract
# Server is a class
for prop, Tcontr of TServer.oc
continue if not Server::[prop] or
prop is 'constructor'
Server::[prop] :: Tcontr
Server::[prop] = Server::[prop] |
Has there been any movement on this issue? |
Sorry, no. Haven't had time to work on this project in a while. |
+1 for this |
👍 for class suppport! |
Are CoffeeScript classes supported? I didn't have any luck while trying to put a contract on a class in various ways. Maybe i'm doing something wrong?
Contract for a whole class:
Results in
Contract for a specific method:
Results in "Error: In foo.coffee, Parse error on line 29: Unexpected 'OUTDENT'".
The text was updated successfully, but these errors were encountered: