crystal-book
crystal-book copied to clipboard
Documentation for `include` inside lib structs
You can do this since https://github.com/crystal-lang/crystal/commit/a8dc4fb81ddb0881281fa4617c4237a5a5e908ad:
lib Lib
struct Foo
x : Int32
y : Int16
end
struct Bar
include Foo
z : Int8
end
end
Lib::Bar.new # => Lib::Bar(@x=0, @y=0, @z=0)
I don't know if this has ever been used in the wild at all, but we should probably document it regardless.