vitreo12 / omni

DSL for low-level audio programming.
https://vitreo12.github.io/omni/
MIT License
188 stars 6 forks source link

Member functions for structs? (Rename it to class?) #24

Closed vitreo12 closed 4 years ago

vitreo12 commented 4 years ago
struct Phasor:
    phase float

    def init(phase = 0.0):
        return Phasor.new(phase)

    def perform(phase_increment):
        this.phase += phase_increment
        this.phase = this.phase mod 1.0
vitreo12 commented 4 years ago

Is it really that much better than:

struct Phasor:
    phase float

def init(phase = 0.0):
    return Phasor.new(phase)

def perform(phasor, phase_increment):
    phasor.phase += phase_increment
    phasor.phase = phasor.phase mod 1.0
vitreo12 commented 4 years ago

Closing for now