Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

paulmars
Copy link

salary = 50
name = "Joe"
dept = "Accounting"
employee = {salary, name, dept}
output = "#{employee.name} works in #{employee.dept}"

added to the docs

@jashkenas
Copy link
Owner

Nice idea, but the documentation tries to use "real-world" examples as much as possible, and not foo and bar...

@paulmars
Copy link
Author

Glad to fix it. Let me see if I can figure out something more real.

On Oct 27, 2011, at 2:02 PM, Jeremy [email protected] wrote:

Nice idea, but the documentation tries to use "real-world" examples as much as possible, and not foo and bar...

Reply to this email directly or view it on GitHub:
#1808 (comment)

@gabehollombe
Copy link
Contributor

+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.

@michaelficarra
Copy link
Collaborator

@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.

@paulmars
Copy link
Author

@jashkenas, would the example @showell described suffice? I'm happy to update.

@gabehollombe
Copy link
Contributor

@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. =-)

@michaelficarra
Copy link
Collaborator

@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.

@michaelficarra
Copy link
Collaborator

@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.

@gabehollombe
Copy link
Contributor

Thanks, Michael. I'll look forward to your link for more documentation
inspiration. In the meantime, the undocumented tag for CS issues is a
great place to start chipping away.

On Sat, Jun 2, 2012 at 4:06 AM, Michael Ficarra <
[email protected]

wrote:

@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.


Reply to this email directly or view it on GitHub:
#1808 (comment)

@paulmars
Copy link
Author

@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!

@showell
Copy link

showell commented Jun 29, 2012

@paulmars Sorry, I don't have merge powers.

@paulmars
Copy link
Author

@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
Copy link
Collaborator

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.

Copy link
Collaborator

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.

Copy link
Author

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.

@michaelficarra
Copy link
Collaborator

@gabehollombe: @paulmars:

I forgot to post back here with some undocumented features. Here's some that I thought of this week:

  • existential operators (Docs: enhance documentation of existential operators #1631)
  • not in, not of, not instanceof
  • let-expressions (do (x = y) ->)
  • standalone extends
  • anonymous classes
  • condition-less switch
  • seq operator (;)
  • destructuring everywhere assignment happens
  • shallow copy (postfix [..])
  • heregex interpolation
  • binary literals (0b01010101)

@jashkenas
Copy link
Owner

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.

@gabehollombe
Copy link
Contributor

OK. Pick a theme: Zombies, Super Powers, or Famous Movie Characters. I'll have fun with it... =-)

@GeoffreyBooth
Copy link
Collaborator

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.

GeoffreyBooth pushed a commit that referenced this pull request Nov 21, 2016
* Docs shorthand object notation

A simple but slightly more imaginative example of shorthand object notation.

Closes #1808.

Signed-off-by: Daniel Bayley <[email protected]>

* Update for new documentation folder structure

* Fix typo
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.

7 participants