Code Monkey home page Code Monkey logo

ripple's Introduction

Ripple

Ripple is a systems level programming language, that has the static memory safety of Rust, with the syntax of C#, and many of the powerful generics/templates features of C++.

Primary Features:

  • Static memory safety (with lifetime inference)
  • C# like syntax
  • Turing complete generics
  • OOP with classes
  • Memory safe lambdas
  • Module and Package system
  • C and C++ Interoperability
  • Traits and Type-classes with Interfaces
  • Rust like move, copy, and clone semantics

Examples:

Hello World:

using module Core.IO;

func Main() -> void
{
  Console.PrintLine("Hello World!");
}

External Code and Generics:

extern "C" malloc(usize size) -> mut void*;
extern "C" free(void* ptr) -> void;

module Core.Memory
{
  unsafe func New<T, TArgs...>(TArgs args...) -> T*
    where T is IConstructable<TArgs...>
  { 
    T mut* ptr = malloc(sizeof<T>()) as T mut*;
    ptr := T(args...);
    return ptr;
  }

  unsafe func<T> Delete(T mut* ptr) -> void
  {
    comptime if(T is Destructible)
      ptr->~T();

    free(ptr as void*);
  }
}

Classes and Data Structures:

using module Core.Memory;

module Core
{
  class Unique<T> : IDereferencable<T>
  {
    private unsafe T* ptr;
    public Unique<TArgs...>(TArgs args...) 
      where T is IConstructable<TArgs...>
    {
      unsafe
      {
        ptr = New<T>(args...);
      }
    }
    
    public func Indirect(this ?mut&) -> T& { return ptr as T ?mut&; }

    public ~Unique()
    {
      unsafe
      {
        Delete(ptr);
      }
    }
  }
  
  impl<T> ICloneable for Unique<T> where T is ICloneable
  {
    public func Clone(this&) -> Unique<T>
    {
      return Unique(ptr->Clone());
    }
  }
}

Notes:

ripple's People

Contributors

fisharmy100 avatar

Stargazers

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