Pound for Pound – comparative analysis between Golang and Vlang

Golang, having been developed in the crucibles of Google, and even having taken a distinct stylistic departure for the C/C++ family of languages, is unquestionably a formidable force in delivering value through software applications. It has even more so found a niche in distributed systems and microservices, where it is continually pushing pushing hard to take the coveted crown from the perennial contenders like Java and C#. Its simplicity is ironically its main allure and perhaps even its greatest strength.

Vlang is stylistically close to Golang, even while still claiming to remain interoperable with C. It has quite a lavish list of claims it makes, but unfortunately, it’s hard to be objective about the accuracy of these claims since the project has not had the level of success that Go has reached. Nevertheless, it would be a great exercise to see how the two languages make similar stylistic choices and also examine places where the two depart.

The inspiration for this analysis is from the respective documentation sites for the two projects

Go – https://gobyexample.com/

Vlang – https://github.com/vlang/v/blob/master/doc/docs.md

Installation

Installing V from source

git clone https://github.com/vlang/v
cd v
make
# HINT: Using Windows?: run make.bat in the cmd.exe shell

Installing Go

This depends on your system – Linux, Mac, Windows

For detailed explanations, consult Go home page

Upgrading to the latest

Vlang

v up

Golang

Starting a new project

Vlang

  • v init → adds necessary files to the current folder to make it a V project
  • v new abc → creates a new project in the new folder abc, by default a “hello world” project.
  • v new --web abcd → creates a new project in the new folder abcd, using the vweb template.

Golang

go mod init example/hello

Online Playground

Both have an online playground which is very helpful in discussions and collaborating without having to install and setup a development environment on a machine

For Vlang, visit -> V Playground

For Golang, visit -> Go Playground

Hello World program

Due to V’s built-in scripting capability, defining a package for the default program file can be ignored. Go is a bit more rigid in that regard.

Vlang

fn main() {
	println('hello world')
}

Golang

package main
import "fmt"
func main() {
    fmt.Println("hello world")
}

One response to “Pound for Pound – comparative analysis between Golang and Vlang”

  1. Hi, this is a comment.
    To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard.
    Commenter avatars come from Gravatar.