Feature #12096
closedNew notation for instance variables and class variables
Description
In order to create symbols that include non-word characters, we have the :'...'
notation:
:'foo-bar'
:"foo-bar"
What about extending this notation to instance variables and class variables? The use case is to solve the problems raised in #12046, #11167, #10720. There, the problem was that, even though we can have methods like foo?
or symbols like :foo?
, we cannot have corresponding instance variables. My proposal is to introduce a similar notation for instance variables:
@'foo?'
@"foo?"
I can't think of a similar use case for class variables, but there is no reason to make class variables to behave different from instance variables more than necessary, so there can also be the corresponding notation for class variables:
@@'foo?'
@@"foo?"
Right now, these notations raise syntax errors, so I don't think it conflicts (raises ambiguity) with the existing syntax.