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

[improve] Steroids for the type system #30

Open
nilq opened this issue Jul 5, 2020 · 0 comments
Open

[improve] Steroids for the type system #30

nilq opened this issue Jul 5, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@nilq
Copy link
Member

nilq commented Jul 5, 2020

Wu should have sum types as well as interface-like type parameters. This will speed up the development process, while also making it even more fun and nice to use the language:

Cat: struct {
  weight: float
}

Dog: struct {
  hat: bool
}

dog_or_cat: Cat | Dog = new Cat {
  weight: 1000
}

# can later be Dog

Then the following:

Vector3: struct {
  x: float, y: float, z: float
}

Vector2: struct {
  x: float, y: float
}

move2D: fun(thing: { x: float, y: float}, dx: float, dy: float) {
  thing x += dx
  thing y += dy
}
@evolbug evolbug added the enhancement New feature or request label Jul 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants