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

davidhesselbom opened this issue Aug 18, 2014 · 0 comments


Copy link

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 {

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.