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

Support abstract operators #796

Closed
davidhesselbom opened this issue Aug 18, 2014 · 0 comments
Closed

Support abstract operators #796

davidhesselbom opened this issue Aug 18, 2014 · 0 comments
Milestone

Comments

@davidhesselbom
Copy link
Contributor

@davidhesselbom davidhesselbom commented Aug 18, 2014

It should be possible to make abstract operators and use them in methods in abstract classes. Example (does not currently build):

Matrix: abstract class {
// I don't know if it should be "abstract operator" or "operator abstract", but either works for me
    abstract operator [] (index: Int) -> Int
    getFirst: func -> Int {
        this[0]
    }
}

PunyMatrix: class extends Matrix {
    a, b, c, d : Int
    init: func (=a, =b, =c, =d)
    operator [] (index: Int) -> Int {
        match (index) {
            case 0 => matrix a
            case 1 => matrix b
            case 2 => matrix c
            case 3 => matrix d
        }
    }
}
@alexnask alexnask closed this in bbb4471 Aug 18, 2014
@fasterthanlime fasterthanlime added this to the 0.9.10 milestone Jul 10, 2015
@fasterthanlime fasterthanlime added this to the 0.9.10 milestone Jul 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants