Another way around this is overloading dot operators. Apparently this now works 
without the `{.experimental: "dotOperators".}` pragma:
    
    
    type
      Obj = ref object
        getStep: proc(): int
        setStep: proc(x: int)
    
    template `.`(o: Obj, f: untyped): untyped = (o.`get f`())
    template `.=`(o: Obj, f, v: untyped): untyped = (o.`set f`(v))
    
    let o = Obj(getStep: proc(): int = 0, setStep: proc(x: int) = echo x)
    echo o.step
    o.step = 1
    
    
    Run

Reply via email to