Closed hachi8833 closed 6 years ago
Assuming this would be implemented, I'd personally prefer a warning. Definitely not A, which wouldn't solve the ambiguity problem.
@hachi8833 this could be scanned by linter I think
I'm changing my mind around this: I'd close this issue, ok?
As you know, Ruby's
#=
methods fromattr_accessor
orattr_writer
are pretty confusing when assigning:Essentially, Ruby has a duality: you sometime call the ones "instance variables" and sometime "attributes".
Goby behaviors the same as above for now.
I hope Goby could provide a syntax level solution for that. Which of the following is preferable?
self.
within a classbar =
is equivalent toself.bar
in the classattr_accessor :bar
and thenbar = "hoge"
within the class prints "Warning: you are trying to create a variable with the same name as an instance variable."@
to access instance variables in the case.attr_*
syntax toattr_accessor @bar, @baz
or like that to indicate that it actually creates instance variables.Personally I prefer to C, next B because A still have an ambiguity among
@bar
and#bar
andbar
for internal use:B is less excessive and would be nice for Ruby.
Any suggestions?