This is my use case.
# module A
type
Control* = ref object or RootObj
m_text* : string # ( This should be private)
handle* : HWND # ( This can be public)
...
# module B
import A
# here is the implementation of all the methods & properties of Control
proc `text=`*(me : Control, sText : string) =
me.m_text = sText
if me.isCreated :
# change the control text too.
proc `text`*(me : Control) : string =
result = me.m_text
Run
So now, by this setup, user of this type can access m_text. But i want to block
that access. And i dont want to mix the implementation code with type
declaration code. I need to split as much code as possible.