for property access you can use a distinct type and for assignment an operator 
like :=
    
    
    type
      Obj = ref object
        fStep: int
      ObjStepProperty = distinct Obj
    
    template step(self: Obj): ObjStepProperty = self.ObjStepProperty
    
    proc `:=` (self: ObjStepProperty, val: int) {.inline.} =
      self.Obj.fStep = val
    
    converter toInt (self: ObjStepProperty): int {.inline.} = self.Obj.fStep
    
    when isMainModule:
      
      var o = Obj()
      
      echo o.step
      
      o.step := 2
      
      echo o.step
    
    
    Run

Reply via email to