P
Philipp Kern
Hi Ruby folks.
It's impossible to me to inherit a class from Struct when the class does not
share its constructor with the Struct superclass.
Struct implements .new on its own, instead of properly implementing it by
initialize, so the following is impossible:
class X < Struct
def initialize; superfoo, :bar); end
end
X.new # => ArgumentError: wrong number of arguments (0 for 1)
I think it should be implemented the normal Ruby way, Struct.new should inherit
from Class.new like all the other objects so that proper inheritation gets
possible.
Any comments on this? Or is this even intended behaviour?
Bye,
phil
It's impossible to me to inherit a class from Struct when the class does not
share its constructor with the Struct superclass.
Struct implements .new on its own, instead of properly implementing it by
initialize, so the following is impossible:
class X < Struct
def initialize; superfoo, :bar); end
end
X.new # => ArgumentError: wrong number of arguments (0 for 1)
I think it should be implemented the normal Ruby way, Struct.new should inherit
from Class.new like all the other objects so that proper inheritation gets
possible.
Any comments on this? Or is this even intended behaviour?
Bye,
phil