Skip to content

Conversation

@michaelglass
Copy link
Member

putting attributes on the prototype does not use more memory than putting it on the constructor function.

putting attributes on the prototype does not use more memory than putting it on the constructor function.
@iainbeeston
Copy link
Member

It might be worth explaining the difference between defining a constant on the prototype vs on the constructor. As it is I find it confusing which one is the "correct" way of defining a class variable (I'm thinking maybe on the prototype would be better, but I haven't really thought about the pros and cons)

@michaelglass
Copy link
Member Author

I think I tried to make the difference clear. Either way: existing cookbook entry is dead wrong.

@iainbeeston
Copy link
Member

But I the discussion at the bottom only applies to the @constructor style class method, but not the prototype style. Although it doesn't explicitly say which it is talking about.

@michaelglass
Copy link
Member Author

line 26? there's some usage of prototype. Wanna take a stab at it?

I'm not sure what lives in the realm of "this is coffeescript" vs "this is javascript"

@peterhellberg
Copy link
Member

I’m happy to accept this pull request, we can improve the explanation over time. @iainbeeston Are you cool with that?

@iainbeeston
Copy link
Member

Sure that's fine.

peterhellberg added a commit that referenced this pull request Jun 20, 2013
@peterhellberg peterhellberg merged commit 619d317 into coffeescript-cookbook:master Jun 20, 2013
@peterhellberg
Copy link
Member

@michaelglass I’ve now added you to the contributors team, welcome 🎉

@michaelglass michaelglass deleted the fix_class_attributes_lesson branch August 21, 2013 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants