Object System (II)

role ABC::Duration {
    has $.ticks;

    our method duration-to-str() {
        given $.ticks {
            when Int { .Str; }
            when Rat { .perl; }
        }
    }
}

class ABC::Note does ABC::Duration {
    has $.pitch;

    method Str() { $.pitch ~ self.duration-to-str; }
}

« first < prev (17 / 41) next > last »