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
- closure_methods: OOP purely based on closures bluenote
- Re: closure_methods: OOP purely based on closures Araq
- Re: closure_methods: OOP purely based on closures bluenote
- Re: closure_methods: OOP purely based on closures gemath
- Re: closure_methods: OOP purely based on closure... bluenote
- Re: closure_methods: OOP purely based on cl... adrianv
- Re: closure_methods: OOP purely based o... gemath