Skip to content

dev@lang

Olivier DALET edited this page Feb 11, 2022 · 11 revisions

Languages

Misc information

Oracle GraalVM

Lesser-known languages worth looking at

Microsoft Researh

  • Ruby-like, statically type checked, built-in type inference
  • C-bindings
  • Null representation: union between the type and nil

Example:

if rand(2) > 0
  my_string = "hello world"
end

puts my_string.upcase

gives:

$ crystal hello_world.cr
Error in hello_world.cr:5: undefined method 'upcase' for Nil (compile-time type is (String | Nil))

puts my_string.upcase

Nim - statically typed compiled systems programming language

It combines successful concepts from mature languages like Python, Ada and Modula.

  • Python-like
  • Inspiration from Ada and modula
  • Modern type system with local type inference, tuples, generics and sum types.
  • Nim's memory management is deterministic and customizable with destructors and move semantics, inspired by C++ and Rust.
import strformat

type
  Person = object
    name: string
    age: Natural # Ensures the age is positive

let people = [
  Person(name: "John", age: 45),
  Person(name: "Kate", age: 30)
]

for person in people:
  # Type-safe string interpolation,
  # evaluated at compile time.
  echo(fmt"{person.name} is {person.age} years old")

Zig - general-purpose programming language and toolchain for maintaining robust, optimal, and reusable software

const std = @import("std");
const json = std.json;
const payload =
    \\{
    \\    "vals": {
    \\        "testing": 1,
    \\        "production": 42
    \\    },
    \\    "uptime": 9999
    \\}
;
const Config = struct {
    vals: struct { testing: u8, production: u8 },
    uptime: u64,
};
const config = x: {
    var stream = json.TokenStream.init(payload);
    const res = json.parse(Config, &stream, .{});
    // Assert no error can occur since we are
    // parsing this JSON at comptime!
    break :x res catch unreachable;
};
pub fn main() !void {
    if (config.vals.production > 50) {
        @compileError("only up to 50 supported");
    }
    std.log.info("up={d}", .{config.uptime});
}

V - Simple, fast, safe, compiled. For developing maintainable software.

  • Go-like
fn main() {
    areas := ['game', 'web', 'tools', 'science', 'systems',
              'embedded', 'drivers', 'GUI', 'mobile']
    for area in areas {
        println('Hello, $area developers!')
    }
}

Beef - performance-oriented compiled language built hand-in-hand with its IDE environment

  • C#-like, but compiles to native
  • Comes with a Graphical IDE (Windows-only for now)
using System;

namespace Hello {
    class Program {
        static void Main() {
            Console.WriteLine("Hello, world!");
        }
    }
}

Odin - The C alternative for the joy of programming

general-purpose programming language with distinct typing, built for high performance, modern systems, and built-in data-oriented data types.

package main

import "core:fmt"

main :: proc() {
  program := "+ + * 😃 - /"
  accumulator := 0  
  for token in program {
    switch token {
    case '+': accumulator += 1
    case '-': accumulator -= 1
    case '*': accumulator *= 2
    case '/': accumulator /= 2
    case '😃': accumulator *= accumulator
    case: // Ignore everything else
    }
  } 
  fmt.printf("The program \"%s\" calculates the value %d\n",
             program, accumulator)
}

Kit - A magical, high performance programming language for game development

include "stdio.h";

function main() {
    var s: CString = "Hello from Kit!";
    printf("%s\n", s);
}

Other ones (toy & small languages)

Clone this wiki locally