volt


Live code reloading
volt supports live code reloading, which makes it perfect for developing scientific applications and games:

About the language volt is written in

Originally volt app was written in Go, but after a couple of weeks of development I decided to re-write it in C for two reasons: easier integration with existing C graphics and UI libraries and much smaller and lighter binaries. The app size reduced from ~5 MB to ~100 KB.

C development is not very productive, so I spent two weeks in October 2017 to create a very light and minimalistic language that can seamlessly interop with C. I haven't come up with a name yet, so I simply call it volt for now.

The compiler is written in volt. The language will be open-sourced later in 2018. The key features are:

Fast compilation
The entire volt project (~15 kloc) is compiled in ~0.2s.

Simplicity
volt is very similar to Go in this regard. There's only one of way of doing things.

High performance
volt is compiled directly to x86_64 machine code (ARM support is coming later) with no overhead, so the performance is on par with C.

Safety
- Variables are immutable by default
- Globals are not allowed
- There's no null
- Functions are partially pure (only receivers can be modified)
- No variable shadowing


Here's a Hello World GUI example:

 

package main

import ui 

type Context struct {
    input ui.TextBox
}

fn main() {
    wnd := ui.new_window({ 
        width:  600 
        height: 300 
        title:  'hello world' 
    }) 
    ctx := Context{
        input: ui.new_textbox(wnd) 
    }
    ctx.input.set_placeholder('Enter your name')
    btn := ui.new_button(wnd, 'Click me', ctx.btn_click)
    for {
        ui.wait_events()
    }
}

fn (ctx mut Context) btn_click() { 
    name := ctx.input.text()
    ctx.input.hide()
    ui.alert('Hello, $name!')
}