To the best thing the play online game is
[https://texttwist.online](https://texttwist.online) so more the chance to the
great.
@Lando I think you misunderstood me. I like properties for the reasons you
mentioned (mainly: not giving a damn). I just don't like the fact they work
differently in the module the type is defined in.
As for whether properties are good: it depends. Memoized properties are often a
good usecase:
@Udiknedormi: I see how that would make sense. There is that ambiguity that
_a.host = 34_ can mean two completely different things inside the module:
* call the assignment operator
* call a procedure named _host=_
But Nim seems to consciously embrace ambiguity to accomplish separation of
It seems to me it would be better to not allow a getter/setter to be named just
like a private field. It's quite misleading.
Thanks again @Lando for confirming this. It more clear to me now. Best Regards
Correct. This is why the name of the field was changed to something other than
_host_ in the updated example code.
@Lando, Many thanks for your reply, much appreciated. I was really confused.
This is how I understand the concept from your reply. Please correct me if I am
wrong.
* if ' s.host = 34 ' is called from the _same module_, it will directly
access the object variable bypassing the 's.host=' method
The example from the tutorial is a bit misleading, try the updated [version
from the language
manual](https://nim-lang.org/docs/manual.html#procedures-properties) instead.
The _host_ field of a _Socket_ object is invisible to code from a different
module, but the tutorial example code accesses
Aplologies, there was an error in my program, corrected now. My question still
stands though. Thanks.
Hello all,
A newbie here. I have been learning Nim using the online tutorials and is
thoroughly enjoying Nim . I have completed the part 1 and have advanced to Part
2 of the tutorial. Have a question regarding the setter methods discussed in
the 'Properties' section of the tutorial. Can you ple
10 matches
Mail list logo