Nim (programming language): Difference between revisions

Content deleted Content added
m Function composition: fmt., "allow for" ≠ "allow"
Line 549:
 
==== Method calls and encapsulation ====
Nim's [[Uniform Function Call Syntax|uniform function call syntax]] enables calling ordinary functions with syntax similar to method call invocations in other programming languages. This is functional for "getters": and Nim also provides syntax for the creation of such "setters" as well. Objects may be made public on a per-field basis, providing for encapsulation.
<syntaxhighlight lang="nim">
type Socket* = ref object
host: int # private, lacks export marker