@sshw

> I tried Skaruts's code in the Nim playground and it seems accessing Euler(x: 
> 3.0).x doesn't call the method, but returns the field value.

That's because you're accessing it from within the same module. I didn't think 
of mentioning this before, but the trick will only work if you access `x` from 
another module, such that it will only ever see the methods and not the 
property. The only two sure ways that I know to actually enforce that the 
method gets called from within the module, is to either call it explicitly 
`this.`x=`(10)` or to rename the property itself. In this case it would 
actually be nice to be able to use a leading or trailing underscore.

> How underscores improve readability?

They help you tell apart at a mere glance what is and what isn't private, as 
well as some other kinds of distinctions people might make (like python's/lua 
methods `__init__`/`__index`, etc). 

Reply via email to