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

Enums #5

Open
rymiel opened this issue Jul 3, 2022 · 1 comment
Open

Enums #5

rymiel opened this issue Jul 3, 2022 · 1 comment

Comments

@rymiel
Copy link
Member

rymiel commented Jul 3, 2022

yume/example/bf.ym

Lines 1 to 2 in 8891c4c

# TODO
# This would be a lot clearer if i had enums

The language should support "dumb" enums, which are a simple wrapper around an integral type to allow using it with clear names in source code. Note that stringification of enum entries is a requirement for this.

For combining multiple values which aren't simply numbers, unions will exist instead for that purpose (and should go in a separate issue)

@rymiel
Copy link
Member Author

rymiel commented Jul 10, 2022

Roadmap

  • Parse enums into their ast node
  • User defined ctor #13 Implement custom constructors. Required for the point below
  • Implement named constructors. Each enum member will create a corresponding named, no-arg constructor of that enum
  • Transform enums into their corresponding structs, desugaring them. Probably need a more robust AST transformation system (as in one at all, see destructor implementation notes)
  • Full implementation (with data members and names of members)
  • etc

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

No branches or pull requests

1 participant