Updated Nim for Python Programmers (markdown)

This commit is contained in:
Federico Ceratto 2015-04-11 16:21:57 +01:00
parent ad1c6c3313
commit 6c15143548
1 changed files with 2 additions and 2 deletions

View File

@ -80,7 +80,7 @@ In Nim you are strongly discouraged from using pointers in Nim, and you can acc
### Object-Orientation
Objects in Nim behave quite differently from classes in Python. Objects support inheritance (not multiple inheritance).
Python-like object methods do not exist; Procs are not bound to objects:
Python-like object methods do not exist: procs are not bound to objects (however, you can use them in ways very similar to Python, see the example below)
You can call a proc on objects with the ```anObject.foobar()```, but you can do that on any type (e.g. ints and arrays) as well. You can have methods on object, but you can have methods on any types, and for all the arguments, not just the first (in C++, implicit) one.
@ -88,7 +88,7 @@ Nim does not have an implicit _self_.
It is possible to implement object-orientation features through libraries, thanks to the extensive meta-programming features of Nim. These are at the moment mostly work-in-progress.
Object orientation example:
Python-like object orientation example:
```Nim
type Animal = ref object of RootObj