Giter Site home page Giter Site logo

oolib's Introduction

👑OOlib

license code size
nimble

icon

OOlib is currently work in progress🔥

🗺Overview

OOlib is a syntax sugar which provides user-defined types, procedures, etc...

📜Usage

import strformat
import oolib


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

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

  proc happyBirthday* =
    inc self.age


# auto define constructor
let p = newPerson("Tony")

✨Features

  • Member variables with default values
  • 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 (for now, only object can be inherited)
  • Creating distinct type with distinct modifier
  • {.final.} by default
  • {.open.} to allow inheritance
  • super keyword for method

💭Planned

  • Support for more modifiers (e.g. [T], {.pragma.})
  • let member variables

🥷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.

oolib's People

Contributors

ftsf avatar glassesneo avatar jiro4989 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.