-
Notifications
You must be signed in to change notification settings - Fork 2k
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 shorthand object notation #1808
Conversation
Nice idea, but the documentation tries to use "real-world" examples as much as possible, and not |
Glad to fix it. Let me see if I can figure out something more real. On Oct 27, 2011, at 2:02 PM, Jeremy Ashkenasreply@reply.github.com wrote:
|
+1 to get this merged. If you're still unhappy with the example provided by @showell in the comment above, let's try to get something that makes sense to @jashkenas. I'm happy to suggest another example if needed. I'd just love to see this added to the docs soon, since it's a great feature and I get sad when the docs aren't as comprehensive as they could be. This feels like something we can surely get into the docs without too much more effort. |
@gabehollombe: There are many important, undocumented features. If it really does bother you, want to take it upon yourself to document them all and open a pull request? I'd love to finally see comprehensive documentation. |
@jashkenas, would the example @showell described suffice? I'm happy to update. |
@michaelficarra I would absolutely love to help out and start documenting the important features you think need documentation. Do you want to throw a list of targets for me up on the wiki, or in an email? Either way, please just share the areas you think need mentioning or improvement and I'll totally take a crack at it. =-) |
@gabehollombe: Well, you could start with the various nuances of our whitespace sensitivity. The numerous issues mentioning undocumented features are also a good starting point. |
@gabehollombe: As part of my kickstarter project, I'll be compiling a comprehensive list of all (intentional) coffeescript features. It probably won't be comprehensive on my first try, but it'll be a good place to look for features that may be lacking in documentation. I'll post a link when I'm done. |
Thanks, Michael. I'll look forward to your link for more documentation On Sat, Jun 2, 2012 at 4:06 AM, Michael Ficarra <
|
@showell I'd like to get this merged so I can make more improvements in the docs. Do you have merging abilities. If I make your recommended changes will this get merged? @gabehollombe @michaelficarra Thanks for the support. Lets see if we can get this merged! |
@paulmars Sorry, I don't have merge powers. |
@jashkenas I believe the current code address all the thoughts brought up in this thread. Can you please merge? |
@@ -418,6 +418,11 @@ Expressions | |||
about it (say, when using jQuery). | |||
</p> | |||
<%= code_for('objects_reserved') %> | |||
<p> | |||
CoffeeScript has a shortcut for creating objects when you want the object name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say "key name" here. LGTM otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that number/string literals also work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michaelficarra done.
@satyr I'm going to leave that for a future commit and pull request. I'd like to get this merged after 8 months of waiting rather than complicate the pull request.
I forgot to post back here with some undocumented features. Here's some that I thought of this week:
|
I'd be glad to merge, but first -- let's change the example to be something a little more exciting than Joe in accounting. Use your imagination. |
OK. Pick a theme: Zombies, Super Powers, or Famous Movie Characters. I'll have fun with it... =-) |
Has this PR really been sitting open for five years just because no one can come up with a more exciting example than Joe in accounting? This PR is only for documentation, not a new feature. This object creation shorthand has actually been adopted by ES2015, and people probably have no idea that we pioneered it, because this never made it into the documentation. Okay folks now’s your chance. The floodgates are open. Best example wins. |
* Docs shorthand object notation A simple but slightly more imaginative example of shorthand object notation. Closes #1808. Signed-off-by: Daniel Bayley <daniel.bayley@me.com> * Update for new documentation folder structure * Fix typo
salary = 50
name = "Joe"
dept = "Accounting"
employee = {salary, name, dept}
output = "#{employee.name} works in #{employee.dept}"
added to the docs