Update README.md
This commit is contained in:
parent
6a367c7661
commit
f41b5f5140
1 changed files with 27 additions and 1 deletions
28
README.md
28
README.md
|
|
@ -1,2 +1,28 @@
|
||||||
# nim-extentions
|
# nim-extensions
|
||||||
Extensions for the nim programming language.
|
Extensions for the nim programming language.
|
||||||
|
|
||||||
|
These extensions aim to improve the usability of nim in practical applications.
|
||||||
|
|
||||||
|
Extensions so far include:
|
||||||
|
|
||||||
|
## OOP macro
|
||||||
|
usage:
|
||||||
|
|
||||||
|
```nim
|
||||||
|
class BaseObject: # inherits from RootObj
|
||||||
|
# attributes/properties
|
||||||
|
var
|
||||||
|
x: int
|
||||||
|
y: float
|
||||||
|
|
||||||
|
method override_me(argx: float): int=
|
||||||
|
result = int(argx) + self.x
|
||||||
|
|
||||||
|
class ClassName of BaseObject:
|
||||||
|
method method_name(arg1: int, arg2: float=0.3): float=
|
||||||
|
## do stuff here
|
||||||
|
result = arg2
|
||||||
|
|
||||||
|
method override_me(argx: float): int=
|
||||||
|
result = int(self.y) + int(argx) + self.x
|
||||||
|
```
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue