V (programming language)
The official V logo | |
| Paradigms | Multi-paradigm: functional, imperative, structured |
|---|---|
| Designed by | Alexander Medvednikov[1] |
| First appeared | 25 June 2019[2] |
| Stable release | 0.4.x[3]
|
| Typing discipline | Static, strong |
| Implementation language | V |
| Platform | Cross-platform |
| License | MIT |
| Filename extensions | .v, .vsh |
| Website | vlang |
| Influenced by | |
| Influenced | |
| Aixt[4] | |
Search V (programming language) on Amazon.
V, or Vlang, is a general-purpose programming language designed by Alexander Medvednikov. It is mostly inspired by the Go programming language but was also influenced by C, Rust, and Oberon-2.[5][6] The foremost goal of V is to be easy to use[7][8], and at the same time, venturing to enforce a safe coding style through elimination of ambiguity. For example, variable shadowing is not allowed[9]; declaring a variable with a name that is already used in a parent scope will cause a compilation error.
History
The language came about because of frustration with existing programming languages that were being used for personal projects. Originally the new language was intended for personal use, but after it was mentioned publicly and gained interest, it was decided to make the language public.[10] Initially, it had the same name as a product known as Volt. The V language was created in order to develop it, along with other software applications such as Ved (also called Vid). As the extension in use was already ".v", to not mess up the git history (and reduce drama), it was decided to name it "V".[11] Upon public release, the compiler was written in V, and could compile itself.[12]
Along with the language creator, its community has a large number of contributors[13] who join the project[14] and have helped with continually developing the compiler, language, and modules. Key design goals and features that V seeks to deliver are: easier to learn and use, higher readability, fast compilation, increased safety, efficient development, cross-platform usability, improved C interop, better error handling, modern features, and more maintainable software.[15][16][10][17]

Features
Safety
- Bounds checking
- Mandatory error checks
- Option/Result types
- Sum types
- Generics
- Immutable variables by default
- Immutable structs by default
- Immutable function args by default
- No undefined values
- No variable shadowing
- No null (allowed in unsafe code)
- No undefined behavior (WIP)
- No global variables (can be enabled for low level via flag)
Performance
- Fast like C (V's main backend compiles to human readable C), with equivalent valid code.[18][19][20][21]
- Various features can be reviewed, disabled, and bypassed when speed is more important.
- C interop without any costs[22][17]
- Minimal amount of allocations[23]
- Built-in serialization without runtime reflection[9]
- Compiles to native binaries without any dependencies[6]
Fast build
V is written in V and can compile itself in less than a second.[24][25][26]
Flexible memory management
V avoids doing unnecessary allocations by using value types, string buffers, and promoting a simple abstraction-free code style.
Presently, allocations are handled by an optional GC, as the default (which can be disabled).
Autofree can be enabled with -autofree. The compiler inserts necessary free calls automatically during compilation. The remaining percentage of objects are freed via GC.
For developers willing to have more low level control, memory can be managed manually with -gc none.
Arena allocation is available via v -prealloc.
Source code translators (code transpilation)
V can translate entire C projects (via modules).[27][28] For example, translating DOOM from C to V, which can take less than a second.[29]
Working translators, under various stages of development, exist for Go, JavaScript, and WASM.[30][31][32][33]
Syntax
Hello world
fn main() {
println("hello world")
}
Structs
struct Point {
x int
y int
}
mut p := Point{
x: 10
y: 20
}
println(p.x) // Struct fields are accessed using a dot
// Alternative literal syntax for structs with 3 fields or fewer
p = Point{10, 20}
assert p.x == 10
Heap structs
Structs are allocated on the stack. To allocate a struct on the heap and get a reference to it, use the & prefix:
struct Point {
x int
y int
}
p := &Point{10, 10}
// References have the same syntax for accessing fields
println(p.x)
Methods
V doesn't have classes, but you can define methods to types. A method is a function with a special receiver argument. The receiver appears in its own argument list between the fn keyword and the method name. Methods must be in the same module as the receiver type.
In this example, the can_register method has a receiver of type User named u. The convention is not to use receiver names like self or this, but a short, preferably one letter long, name.
struct User {
age int
}
fn (u User) can_register() bool {
return u.age > 16
}
user := User{
age: 10
}
println(user.can_register()) // "false"
user2 := User{
age: 20
}
println(user2.can_register()) // "true"
Error handling
Optional types are for types which may represent none. Result types may represent an error returned from a function.
Option types are declared by prepending ? to the type name: ?Type. Result types use !: !Type.
fn do_something(s string) !string {
if s == "foo" { return "foo" }
return error("invalid string")
}
a := do_something("foo") or { "default" } // a will be "foo"
b := do_something("bar") or { "default" } // b will be "default"
c := do_something("bar") or { panic("{err}") } // exits with error 'invalid string' and a traceback
println(a)
println(b)
Vweb (or Veb)
import vweb
struct App {
vweb.Context
}
fn main() {
vweb.run(&App{}, 8080)
}
or
import vweb
struct App {
vweb.Context
}
fn main() {
vweb.run_at(new_app(), vweb.RunParams{
host: "localhost"
port: 8099
family: .ip
}) or { panic(err) }
}
ORM
V has a built-in ORM (object-relational mapping) which supports SQLite, MySQL and Postgres, but soon it will support MS SQL and Oracle.
V's ORM provides a number of benefits:
- One syntax for all SQL dialects. (Migrating between databases becomes much easier.)
- Queries are constructed using V's syntax. (There's no need to learn another syntax.)
- Safety. (All queries are automatically sanitized to prevent SQL injection.)
- Compile time checks. (This prevents typos which can only be caught during runtime.)
- Readability and simplicity. (You don't need to manually parse the results of a query and then manually construct objects from the parsed results.)
import pg
struct Member {
id string [default: "gen_random_uuid()"; primary; sql_type: "uuid"]
name string
created_at string [default: "CURRENT_TIMESTAMP"; sql_type: "TIMESTAMP"]
}
fn main() {
db := pg.connect(pg.Config{
host: "localhost"
port: 5432
user: "user"
password: "password"
dbname: "dbname"
}) or {
println(err)
return
}
defer {
db.close()
}
sql db {
create table Member
}
new_member := Member{
name: "John Doe"
}
sql db {
insert new_member into Member
}
selected_member := sql db {
select from Member where name == "John Doe" limit 1
}
sql db {
update Member set name = "Hitalo" where id == selected_member.id
}
}
Other features
The Vinix Operating System[34][35] is a demonstration of V's ability to make a usable OS that can run on real hardware, not just emulators or virtual machines. It targets modern 64-bit architectures, CPU features, and multi-core computing. Aims to have source-level compatibility with Linux, allowing the porting over of programs.
Further Reading
Books & Magazines
- Laboratory, Independent (June 20, 2020). V言語入門 (The V Programming Language) (in 日本語). ILab. ASIN B08BKJDRFR. Search this book on

- Rao, Navule (December 10, 2021). Getting Started with V Programming. Packt Publishing. ISBN 1839213434. Search this book on

- Lyons, Dakota "Kai" (April 13, 2022). Beginning with V Programming. Independently Published. ISBN 8801499963 Check
|isbn=value: checksum (help). Search this book on
- Tsoukalos, Mihalis (May 2022). "Discover the V language". Linux Format Magazine (288). ISSN 1470-4234.
- Chakraborty, Soubhik; Haldar, Subhomoy (December 6, 2023). Randomness Revisited using the V Programming Language. Nova Science Publishers. doi:10.52305/CVCN5241. ISBN 8891133280. Search this book on

- Trex, Nova (December 24, 2024). V Programming: Building Robust and Efficient Software Systems Kindle Edition. Wang Press. ISBN 8304813778 Check
|isbn=value: checksum (help). Search this book on
- Sanders, Rafael (September 18, 2025). V Language for Beginners: How to Code with V for Fast, Simple, and Maintainable Software. Lincoln Publishers. ISBN 8263861681 Check
|isbn=value: checksum (help). Search this book on
- Sanders, Rafael (September 18, 2025). V Language Intermediate Guide: How to Build Reliable Software with V’s Simple but Powerful Features. Lincoln Publishers. ISBN 8263865429 Check
|isbn=value: checksum (help). Search this book on
- Silva, Esli (November 11, 2025). Programando em Vlang (Programming in Vlang) (in português). Independently Published. ISBN 6501793047 Check
|isbn=value: checksum (help). Search this book on
Translated Documentation
- "V language learning notes". GitBook (in 中文).
- "V documentation". Qiita (in 日本語).
External links
V Language Review (Videos)
- An introduction to V - the vlang (2022)
- How To Maintain And Iterate With V - SYNCS (2023)
- Is V Lang Better Than Go And Rust? Let's Find Out (2023)
- V language - First Impression (2024)
- V S01E01 Intro (2025)
References
- ↑ "V's creator".
- ↑ "First public release". Retrieved 25 June 2019.
- ↑ "Latest releases".
- ↑ "Aixt - Vlang-based microcontroller programming framework". Retrieved 17 February 2024.
- ↑ James, Ben. "The V Programming Language: Vain Or Virtuous?". Hackaday. Retrieved 23 July 2019.
- ↑ 6.0 6.1 Umoren, Samuel. "Building a Web Server using Vlang". Section (Wayback Machine). Retrieved 5 April 2021. Cite error: Invalid
<ref>tag; name "auto2" defined multiple times with different content - ↑ Knott, Simon. "An introduction to V". Retrieved 27 June 2019.
- ↑ Oliveira, Jader. "VLang for Automation Scripting". LinkedIn. Retrieved 4 June 2021.
- ↑ 9.0 9.1 Shóstak, Vic. "The V programming language". DEV. Retrieved 8 November 2021.
- ↑ 10.0 10.1 "A small presentation of V's features at IBM". YouTube. Retrieved 6 March 2023.
- ↑ "Why "V"?". Vlang FAQ.
- ↑ "V is written in?". Vlang FAQ.
- ↑ "Contributors" – via GitHub.
- ↑ "Help and Contribute to Vlang" – via GitHub.
- ↑ Jonah, Victor. "What is Vlang? An introduction". LogRocket. Retrieved 25 February 2021.
- ↑ Laboratory, Independent (2020). The V Programming Language basic (in 日本語). ASIN B08BKJDRFR. Search this book on
- ↑ 17.0 17.1 Nasufi, Erdet. "An introduction to V". DebConf. Retrieved 24 July 2022.
- ↑ "On the benefits of using C as a language backend". GitHub. Retrieved 4 January 2021.
- ↑ "Building V Language DLL". Rangakrish. Retrieved 2 April 2023.
- ↑ "C is how old now? - Learning the V programming language". l-m (Wayback Machine). Retrieved 10 April 2022.
- ↑ "V language: simple like Go, small binary like Rust". TechRacho (in 日本語). Retrieved 3 March 2021.
- ↑ Abbas, Hazem. "Get Started with V". MEDevel. Retrieved 4 August 2024.
- ↑ "The V programming language is now open source". Packt Hub. Retrieved 24 June 2019.
- ↑ Oliveira, Marcos. "V , the programming language that is making a lot of success". Terminal Root. Retrieved 18 January 2022.
- ↑ "Building V from source in 0.3 seconds". YouTube. Retrieved 28 March 2021.
- ↑ Rao, Navule Pavan Kumar (2021). Getting Started with V Programming. Packt Publishing. ISBN 1839213434. Search this book on
- ↑ "C2V". GitHub.
- ↑ "Translating C to V". GitHub.
- ↑ "C2V Demo: Translating DOOM from C to V". YouTube. Retrieved 23 June 2022.
- ↑ "Go2V". GitHub.
- ↑ "Convert Go to V with go2v". Zenn (in 日本語). Retrieved 26 January 2023.
- ↑ "JavaScript and WASM backends". Vlang site.
- ↑ "The V WebAssembly Compiler Backend". l-m (Wayback Machine). Retrieved 26 February 2023.
- ↑ "Vinix: a new OS/kernel written in V". YouTube. Retrieved 24 November 2021.
- ↑ "Vinix OS". GitHub.
This article "V (programming language)" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:V (programming language). Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.
- CS1 日本語-language sources (ja)
- CS1 português-language sources (pt)
- CS1 中文-language sources (zh)
- Programming languages
- Cross-platform free software
- Cross-platform software
- Free compilers and interpreters
- Programming languages created in 2019
- Statically typed programming languages
- Systems programming languages
- Multi-paradigm programming languages
- Procedural programming languages
- Concurrent programming languages
- Functional languages
- Software using the MIT license
