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

Add missing reserved words: false, let, null, true, and yield. #295

Closed
wants to merge 1 commit into from
Closed

Add missing reserved words: false, let, null, true, and yield. #295

wants to merge 1 commit into from

Conversation

alimony
Copy link

@alimony alimony commented Mar 3, 2013

Source is the section "7.6.1 Reserved Words" in http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf

@rwaldron
Copy link
Member

rwaldron commented Mar 4, 2013

let and yield are FutureReservedWords and are only "reserved" in strict mode.

Furthermore... this list is very, very wrong (unrelated to your changes)

@rwaldron
Copy link
Member

rwaldron commented Mar 4, 2013

This needs to be four lists... essentially something like this:

Null & Boolean Literals

- null
- true
- false

Reserved Words (Keywords)

- break
- case
- catch
- continue
- debugger
- default
- delete
- do
- else
- finally
- for
- function
- if
- in
- instanceof
- new
- return
- switch
- this
- throw
- try
- typeof
- var
- void
- while
- with

Future Reserved Words (unused, treated as Keywords)

- class
- const
- enum
- export
- extends
- import
- super

Future Reserved Words (unused, treated as Keywords in strict mode)

- implements
- interface
- let
- package
- private
- protected
- public
- static
- yield

@alimony
Copy link
Author

alimony commented Mar 5, 2013

Since the purpose of the page (I guess) is to inform someone rather new to JavaScript that there are certain words that should be avoided for variable etc. names, the difference between your first three groups of words might not be that important; even if more correct.

What will matter to the reader/user is that some words will throw errors and others won't. So maybe the first two groups of words you mention could be put in one paragraph, with an explanation saying that they will cause an error because they are "parts of the language" or something similar. The third and fourth groups could be put in another paragraph with an explanation saying that they may end up as part of the language and should be avoided too.

Maybe a distinction should be kept between what will happen in strict mode and not (i.e. separating group three and four), but could that also cause confusion? Having just two groups, the "Don't use these" and the "Avoid these too" has some simplicity to it.

These are just some thoughts. What do you think @rwldrn?

@rwaldron
Copy link
Member

rwaldron commented Mar 5, 2013

@alimony more to the point: the existing list is wrong. you can file a PR or I will just fix it.

@alimony
Copy link
Author

alimony commented Mar 5, 2013

@rwldrn Opened #301 for correcting the list. Even though the full list is only considered reserved in strict mode, it is more correct than the previous one…

@rwaldron
Copy link
Member

rwaldron commented Mar 5, 2013

Love it!

@ajpiano
Copy link
Member

ajpiano commented Mar 14, 2013

#301 is merged. Is there anything else we need to do from this ticket being open -- perhaps the grouping @rwldrn proposed?

@rdworth
Copy link
Contributor

rdworth commented Mar 14, 2013

As this is intro-level content I actually think a single list (not grouped) makes more sense

@rwaldron
Copy link
Member

Nope, @alimony's list is good for me

@ajpiano
Copy link
Member

ajpiano commented Mar 14, 2013

Great!

@ajpiano ajpiano closed this Mar 14, 2013
@alimony alimony deleted the add-reserved-words branch March 14, 2013 18:45
@alimony alimony restored the add-reserved-words branch March 14, 2013 18:53
gnarf pushed a commit to gnarf/learn.jquery.com that referenced this pull request Aug 4, 2014
All of these are only considered reserved when in strict mode, but it is in any case a more correct list than the current one. See jquery#295 for further discussion on how to present this list.
arthurvr pushed a commit to arthurvr/learn.jquery.com that referenced this pull request Jan 4, 2015
All of these are only considered reserved when in strict mode, but it is in any case a more correct list than the current one. See jquery#295 for further discussion on how to present this list.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants