Skip to content

[improve] Steroids for the type system #30

Open
@nilq

Description

@nilq

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
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions