The question says it all. For example:
class Foo
INSTANCE = new
def initialize
p "initialized"
end
end
Will print only when Foo::INSTANCE accessed, not automatically after compilation.
Is it expected behavior?
The question says it all. For example:
class Foo
INSTANCE = new
def initialize
p "initialized"
end
end
Will print only when Foo::INSTANCE accessed, not automatically after compilation.
Is it expected behavior?
Right now, if you don't use a constant it's not even type checked. So constants are only executed if you use them. This might change in the future.