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

Make struct Name into an expression #54

Closed
liquidev opened this issue Mar 28, 2022 · 1 comment · Fixed by #75
Closed

Make struct Name into an expression #54

liquidev opened this issue Mar 28, 2022 · 1 comment · Fixed by #75

Comments

@liquidev
Copy link
Member

Declaring structs ahead of time is a necessity for supporting mutually recursive types, but most types aren't mutually recursive. Therefore it would make sense for struct Name to return the created type in addition to binding it to a variable Name.

Combined with Mica's flexible impl blocks, this would allow for the following idiom:

impl struct Vector
  func new(x, y) construct
    # ...
  end
end
@liquidev liquidev added this to the 0.4.0 milestone Apr 3, 2022
@liquidev liquidev added the sugar label Apr 4, 2022
@liquidev
Copy link
Member Author

liquidev commented Apr 5, 2022

Considering my plan for implementing modules it would also make sense for impl blocks to return the implemented struct.

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

Successfully merging a pull request may close this issue.

1 participant