OOlib
OOlib copied to clipboard
A nimble package for object-oriented programming
Hello! I'm glad you added this feature, but currently this work only for this case: ```nim import oolib protocol Launchable: proc prepareForLaunch() proc launch() proc stop() protocol HotCompilable: proc configureReloading()...
```nim class Dollar(distinct int): proc `+=`(other: Dollar) {.varType.} = self = self + other ``` is converted to ```nim type Dollar = distinct int proc `+=`(self: var Dollar, other: Dollar)...
```nim protocol SomeProtocol: proc implemented(x: int) = return x class SomeClass impl SomeProtocol: discard let some = SomeClass.new() some.implemented(5) ```
```nim class A: var a: int # referring to member variable `a` with {.initial.} var b {.initial.} = self.a ``` is roughly the same as ```nim class A: var a:...
```nim protocol Fruit: proc `new`(title: string, price: int) class Apple: proc `new`(title: string, price: int) = discard ```
```nim class pub A: var a*: int proc a*(value: int) {.setter.} = self.a = value ``` convert to below ```nim type A* = ref object a: int proc a*(self: A):...