Skip to content

Latest commit

 

History

History
72 lines (60 loc) · 1.69 KB

README.md

File metadata and controls

72 lines (60 loc) · 1.69 KB



Nois

Statically typed programming language for the web

Taste of Nois

use std::{ math::pi, iter::MapAdapter }

trait Area {
    fn area(self): Float
}

type Shape {
    Rect(width: Float, height: Float),
    Circle(radius: Float),
}

impl Area for Shape {
    fn area(self): Float {
        match self {
            Shape::Rect(width, height) { width * height }
            Shape::Circle(radius) { pi * radius ^ 2. }
        }
    }
}

pub fn main() {
    let shapes: List<Shape> = [
        Shape::Rect(width: 4., height: 2.),
        Shape::Circle(radius: 12.34),
    ]
    println(
        shapes
            .iter()
            .map(|s| s.area())
            .collect<List<_>>()
            .show()
    )
}

Features

  • Expressive type system
  • Variant types and pattern matching
  • Type class polymorphism with traits
  • Errors are a part of a function type signature (using std::result::Result return type)
  • Automatic memory management
  • Implicit last block line returns

Roadmap

Feature Milestone Status
Lexing 0.1.0
Parsing 0.1.0
Semantic checking 0.1.0
Type checking 0.1.0
Code generation (JS target) 0.1.0
Package support 0.1.0
Useful standard library 0.1.0 🚧
  • ✅ Implemented
  • 🚧 In progress
  • ❌ TBD