Meet V, The New Statically Typed Programming Language Inspired By Go &#038; Rust
A new statically typed compiled programming language, known as V language has been open-sourced recently by its creator Alex Medvednikov. According to Medvednikov, the language is designed for building maintainable software. It is a simple language and is similar to the Go language and is inspired by Rust, Swift, and Oberon languages. Currently, V emits C and uses GCC/Clang for optimized production builds. It manages memory at compilation time (like Rust). For now, it supports Windows, macOS, Linux, *BSD while Android and iOS will be supported later this year. Features Simple The simplicity of this language can be shown in this example. Unlike languages like C and C++, the “hello world” program can be executed easily only by typing “printIn” which is one of the built-in functions to print the value to standard output, i.e. printIn ( ‘hello world’ ). Fast Compilation V compiles ≈1.2 million lines of code per second per CPU core. Such speed is achieved by direct machine code generation and strong modularity. The language can also emit C but the drawback is that the compilation speed then drops to ≈100k lines/second/CPU. The creator, Medvednikov also mentioned that the direct machine code generation is at a very early stage, which supports only x64/Mach-O currently and will try to make it stable enough by the end of this year. Handling Errors V combines Option and Result into one type. If you don’t need to return an error, you can simply return None. This is the primary way of handling errors in V. They are still values, like in Go, but the advantage is that errors can’t be unhandled, and handling them is a lot less verbose. Safety This language has no such things as null, global variables, undefined values, undefined behaviour, variable shadowing or bounds checking. The language supports option/result types, generics, immutable variables by default, pure functions, and immutable structs. Performance According to Medvednikov, this language is as fast as C, minimal amount of allocations, built-in serialization without runtime reflection, C interop without any costs along with compilation to native binaries without any dependencies. Only 400 KiloBytes Compiler With Zero Dependencies Currently, the V compiler does have one dependency which is a C compiler. The entire V language and its standard library are less than 400 KiloBytes. V is written in V, and you can build this language in 0.4 seconds. The creator also ensures to drop this number to ≈0.15 seconds by the end of this year. C/C++ Translation You can easily translate your V code to C or C++ where Clang parser is used for translating C/C++ to V. Also, this feature is at an early stage and Medvednikov aims to make this feature stable by the end of this year. Comparison Of V With Other Languages Variable Declaration In V, variables are declared and initialised with “:=” while “=” is used for assigning or to change the value of the variable. This is the only way to declare variables in V which means that the variables will always have an initial value. Unlike most other programming languages, the language V only allows defining variables in functions. Switch And Break Unlike switch and break statements in C and C++, this language does not require the break statement at the end of every block. Maintainable According to the creator, V is a simpler language than C++ and it offers up to 400 times faster compilation, safety, lack of undefined behaviour, easy concurrency, compile-time code generation, etc. Also, compared to Python language, this language is much faster, simpler, safer, more maintainable, etc. Note: The article draws insights from the official documentation. For more information on V, please click here.
A new statically typed compiled programming language, known as V language has been open-sourced recently by its creator Alex Medvednikov. According to Medvednikov, the language is designed for building maintainable software. It is a simple language and is similar to the Go language and is inspired by Rust, Swift, and Oberon languages. Currently, V emits […]
According to Medvednikov, the language is designed for building maintainable software. It is a simple language and is similar
["Go", "Python", "Rust"]
["Go", "TPU", "AWS", "AI", "cloud_platforms:AWS", "Python", "Aim", "C++", "Rust", "R"]
["AI", "Aim", "AWS", "TPU", "Python", "R", "Go", "Rust", "C++", "cloud_platforms:AWS"]
A Technical Journalist who loves writing about Machine Learning and Artificial Intelligence. A lover of music, writing and learning something out of the box.