Source: Eloquent JavaScript: A Modern Introduction to Programming, 2nd Edition by Marijn Haverbeke


Variable names can be any word that isn't reserved as a keyword (such as var). They may not include spaces. Digits can also be part of variable names—catch22 is a valid name, for example—but the name must not start with a digit. A variable name cannot include punctuation, except for the characters $ and _.

may not sounds almost like you may do it if you want to, but if you don't feel like doing it, you may not do it. At least, that's what it sounds like to me. But in programming, there is no place for the may-or-may-not type of attitude. It is always "you must" or your program will be syntactically incorrect and thus won't run. I think that's a very relaxed way to say that you categorically must not do something because it simply will not work if you do. Why not use the modal verb must instead? may not is a very weak type of negation compared to must. Do you think it is totally legal to use may not in the context of exact sciences like math and programming?

  • The author just wants to be extremely polite. 'May not' may be but is rarely used to imply that something is not possible.
    – Michael
    Commented Nov 20, 2015 at 19:48
  • The polite subjunctive form? Commented Nov 20, 2015 at 20:20
  • 1
    Legal? Of course it's legal... no one is going to get put in jail for using "may not" instead of "can not" or "must not"...
    – Catija
    Commented Nov 20, 2015 at 20:39

4 Answers 4


You need the permission of the compiler for things to be accepted, and the compiler is denying you that permission. "May I do this?" "You may not."

May is just as strong as must. It's only weak in the positive sense, where once you're granted permission, you're not obligated to do it.

  • What is the English way for weak negative sense?
    – Alex Che
    Commented Dec 14, 2021 at 16:18

It's not politeness. In computer languages, there are rules. May not means it's not allowed. It's illegal in terms of the rule. Illegal doesn't mean you go to jail. Illegal means it breaks a rule - "contrary to or forbidden by law".

Javascript has rules. :)


They may not include spaces.

There's nothing wrong with the sentence if the OP thinks that it's necessary that the spaces are not used. I think "may not" is almost = must not as you use "may not" for saying that something is not possible.!


It's not the fact that may needs to be always a formal way to ask or say things, it also stands for possibility.

They may not include spaces.

It's a possibility for a thing not to happen.

They must not include spaces.

It stands for without permission, so there's no way for that to happen.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .