glassesneo / OOlib

A nimble package for object-oriented programming
Do What The F*ck You Want To Public License
66 stars 4 forks source link

`setter`/`getter` #89

Closed glassesneo closed 3 months ago

glassesneo commented 2 years ago
class pub A:
  var a*: int
  proc a*(value: int) {.setter.} =
    self.a = value

convert to below

type A* = ref object
  a: int
proc a*(self: A): int = self.a
proc `a=`*(self: A, value: int) =
  self.a = value