For some reason this code will work:
class Foo
@foo = "foo"
end
Foo.new.@foo # => "foo"
And I see, this feature has been used in standard library specs, but it seems to be undocumented one. So, the question is, what is the status of the feature, should one use it?
This feature is currently used for internal purposes, but it is discussed to limit external access to instance variable. A behaviour similar to protected
methods might be useful.
The issue for this is crystal-lang/crystal#6066.
I would generally avoid this feature, as it is undocumented and very likely to be changed at some point.