Live code reloading
V supports live code reloading, which makes it perfect for developing scientific
applications and games:
About V, 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 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 called it V (the name is not final).
V compiler is written in V. The language will be open-sourced later in 2019. The key features are:
Fast compilation
V compiles 15 million lines of code per second on an 8-core desktop CPU.
Simplicity
V is very similar to Go in this regard. There's only one of way of doing things.
High performance
V is compiled directly to x86_64 machine code (ARM support is coming later).
There's also an option to generate C code to support more platforms and achieve better performance by using
sophisticated GCC/clang optimization.
There's no runtime, and number of allocations is minimal.
Safety
- Variables are immutable by default
- Globals are not allowed
- There's no null, replaced by option types
- Functions are partially pure (only receivers can be modified)
- No variable shadowing
Easy interop with C and C++
You can reuse all your existing C/C++ code and libraries and call them from V without any performance costs.
C/C++ to V translator
You can also simply translate your entire C/C++ codebase to V and make your build times up to 400 times faster.
An automatic translator supports the latest standards of these languages.
If you are interested, you can read more about the language in this unfinished draft
of an article.
If you have questions or
suggestions, contact me via
support@volt.ws
vlang.io
Discuss on Slack
Here's a Hello World GUI example:
module mainimport ui// Native cross platform ui toolkit (uses Cocoa, win32, GTK+) // There are no globals, so we have to use a context struct type Contextstruct { input ui.TextBox// this uses native conrols (NSTextView on macOS, edit HWND on Windows) names []string// let's log the names to demonstrate how arrays work }fn main() { wnd := ui.new_window(ui.WindowCfg{// V has no default arguments and overloading. width: 600// All stdlib functions with many args use Cfg wrappers. height: 300 title:'hello world' }) ctx := Context{ input: ui.new_textbox(wnd)// we don't need to initialize the names array, it's done automatically } ctx.input.set_placeholder('Enter your name' ) btn := ui.new_button(wnd,'Click me' , ctx.btn_click)for { ui.wait_events() } }fn (ctxmut Context) btn_click() { name := ctx.input.text() ctx.input.hide() println('current list of names: $ctx.names' )// current list of names: [ "Bob", "Alex" ] ui.alert('Hello, $name!' )if ctx.names.contains(name) { ui.alert('I already greeted you ;)' ) } ctx.names << name }