Skip to content
/ OOlib Public
forked from glassesneo/OOlib

A nimble package for object-oriented programming

License

Notifications You must be signed in to change notification settings

kobi2187/OOlib

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

👑OOlib

license test contributors stars

icon

OOlib is currently work in progress🔥

🗺Overview

OOlib is a nimble package for object oriented programming.

📜Usage

import strformat
import oolib


# add `pub` prefix to export class
class pub Person:
  var
    name*: string
    age* = 0

  # auto insert `self` as first argument
  proc `$`*: string = fmt"<Person> name: {self.name}"

  proc happyBirthday* =
    inc self.age


# auto define constructor
let p1 = newPerson("Tony")
let p2 = newPerson("Steve", 100)

✨Features

  • Member variables with default values
  • Class data constants
  • Definition of proc, method, func, etc... (the only exception being macro)
  • Auto inserting self as first argument
  • Auto definition of constructor (high performance!)
  • Assistance with constructor definition
  • pub modifier instead of *
  • Inheritance with of modifier
  • Creating distinct type with distinct modifier
  • {.final.} by default
  • {.open.} to allow inheritance
  • super keyword for method
  • Alias class

💭Planned

  • Pick like TypeScript's Pick
  • let member variables
  • struct
  • protocol

Changelog

See CHANGELOG

🥷Author

Twitter

License

Copyright © 2021 Neo [email protected] This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.

About

A nimble package for object-oriented programming

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Nim 100.0%