26

What does the notwithstanding keyword mean in Google Go?

2 Answers 2

45

2017 Update: There was a major parser update and the new one no longer seems to support these Easter egg words.


Looks like an easter egg in the lexer to me:

https://github.com/golang/go/blob/08e25fc1ba397e02ec776561ed73b7f9a8b94392/src/cmd/compile/internal/gc/lex.go#L2152-L2156

the relevant section is the symbol table:

"notwithstanding",      LIGNORE,    Txxx,       OXXX,
"thetruthofthematter",  LIGNORE,    Txxx,       OXXX,
"despiteallobjections", LIGNORE,    Txxx,       OXXX,
"whereas",              LIGNORE,    Txxx,       OXXX,
"insofaras",            LIGNORE,    Txxx,       OXXX,

I guess they could be used to test handling of the lexical type LIGNORE, but there doesn't seem to be any "real" ignored tokens.

4
  • 4
    ugh, their lexer function has a label called 'l0' (el-zero) for the beginning statement. compilers should just be designed to delete your code if you actually use l0 as an identifier in your code.
    – Jimmy
    Mar 22, 2010 at 3:21
  • What if you are working within a domain where l0 has a specific meaning? After all lower case pi is just a single letter in greek but we still accept it as the name for an identifier, since we know what it means. Aug 19, 2011 at 10:18
  • 4
    @Jørgen Fogh: I wasn't being serious, but it did cause another answer to this question (which has since been deleted) to say: "Theses all point to "GOTO 10" which I can't find at the moment" which perfectly illustrates the problem. Of course there can be exceptions to every rule.
    – Jimmy
    Aug 19, 2011 at 18:57
  • This is still the case for Go 1.5
    – kalbasit
    Jun 17, 2015 at 18:48
8

The Go Programming Language Specification does not include the keyword 'notwithstanding'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.