ruby / rbs

Type Signature for Ruby
Other
1.92k stars 202 forks source link

Using keywords as identifiers #890

Open hurricup opened 2 years ago

hurricup commented 2 years ago

According to recent sigs update: https://github.com/ruby/rbs/blob/master/sig/polyfill.rbs#L31 some keywords may be used as identifiers. IRR it was not possible in the old lexer/parser. Is there some official position on this and which keywords may/may not be used as identifiers.

soutaro commented 2 years ago

Hi @hurricup! 👋

Yes, the parser now allows having keyword for method names, keyword names, and argument names. I don't think prohibiting them doesn't make much sense. So, I don't have a plan to revert them now.

It is intentional for method names and keyword names because they are allowed in Ruby. (Argument names are accidentally, in fact...)