Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for include inside lib structs #723

Open
HertzDevil opened this issue Dec 14, 2023 · 0 comments
Open

Documentation for include inside lib structs #723

HertzDevil opened this issue Dec 14, 2023 · 0 comments

Comments

@HertzDevil
Copy link
Contributor

You can do this since crystal-lang/crystal@a8dc4fb:

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant