Skip to content

[specification] Interfaces as types #132

@mrodz

Description

@mrodz

Inspired by golang

type Hash interface {
    fn hash(self, fn(int)) -> int
}

class Person: Hash {
    name: str
    age: int
    constructor(self, name: str, age: int) {
        self.name = name
        self.age = age
    }
    fn hash(self, hasher: fn(int)) {
        self.name.hash(hasher)
        self.age.hash(hasher)
    }
}

Metadata

Metadata

Assignees

Labels

compilerIssues related to compilation & parsingenhancementNew feature or request

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions