Support abstract operators #796

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

Projects

None yet

2 participants

@davidhesselbom
Contributor

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
        }
    }
}
@shamanas shamanas closed this in bbb4471 Aug 18, 2014
@fasterthanlime fasterthanlime modified the milestone: 0.9.10 Jul 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment