Getting Started with V Programming
eBook - ePub

Getting Started with V Programming

Navule Pavan Kumar Rao

Share book
  1. 408 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Getting Started with V Programming

Navule Pavan Kumar Rao

Book details
Book preview
Table of contents
Citations

About This Book

Learn a new statically compiled programming language to build maintainable and fast software with the help of this comprehensive guide to V programmingKey Features• Explore the features of the V programming language step by step with this beginner's guide• Gain strong foundational knowledge of core programming concepts such as modules, functions, and structs• Learn how to write super-fast programs and applications that compile in a matter of secondsBook DescriptionA new language on the block, V comes with a promising set of features such as fast compilation and interoperability with other programming languages. This is the first book on the V programming language, packed with concise information and a walkthrough of all the features you need to know to get started with the language. The book begins by covering the fundamentals to help you learn about the basic features of V and the suite of built-in libraries available within the V ecosystem. You'll become familiar with primitive data types, declaring variables, arrays, and maps. In addition to basic programming, you'll develop a solid understanding of the building blocks of programming, including functions, structs, and modules in the V programming language. As you advance through the chapters, you'll learn how to implement concurrency in V Programming, and finally learn how to write test cases for functions. This book takes you through an end-to-end project that will guide you to build fast and maintainable RESTful microservices by leveraging the power of V and its built-in libraries. By the end of this V programming book, you'll be well-versed with the V programming language and be able to start writing your own programs and applications.What you will learn• Become familiar with the basic building blocks of programming in the V language• Install the V language on various operating systems• Understand how to work with arrays and maps in V programming• Discover how to implement concurrency in V programming• Use channels in V programming to learn the best practices of sharing memory by communicating among coroutines• Write modular code and build on your knowledge of structs and functions in V• Get acquainted with writing tests in V programming• Get to grips with building and querying RESTful microservice in VWho this book is forWhether you're a beginner interested in learning a programming language or an experienced programmer looking to switch to a new and better statically compiled programming language, this V programming book is for you.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Getting Started with V Programming an online PDF/ePUB?
Yes, you can access Getting Started with V Programming by Navule Pavan Kumar Rao in PDF and/or ePUB format, as well as other popular books in Ciencia de la computación & Programación en C. We have over one million books available in our catalogue for you to explore.

Information

Year
2021
ISBN
9781839212178

Section 1: Introduction to the V Programming Language

This section provides a detailed introduction to the V programming language. You will also gain an understanding of various features of V and the suite of modules and libraries available within the V ecosystem.
This section also introduces you to approaches to install the V programming language on the various operating systems, which will help readers get started with hands-on examples that will be covered in this book.
This section has the following chapters:
  • Chapter 1, Introduction to V Programming
  • Chapter 2, Installing V Programming

Chapter 1: Introduction to V Programming

The V programming language is a statically typed compiled programming language that's used to build maintainable and robust software applications. It comes with high performance and simplicity, which allows software programmers to do rapid prototyping of applications at scale. You can write simple and clean code with minimal abstraction using V. V comes with performance as fast as C. V is not derived from any other programming language and is written in V itself and compiles itself in under 1 second.
The design of V has been influenced by programming languages such as Go, Rust, Oberon, Swift, Kotlin, and Python. The V language has similar syntax compared to the popular Go programming language. It is a simple, fast, safe, and compiled programming language. V offers all safety features by default, such as immutable variables, immutable structs, and pure functions. V offers great support for concurrency that is on par with Go programming.
In this chapter, we will cover the following topics:
  • The past, present, and future of V
  • V is a statically typed and compiled programming language
  • Simple and maintainable syntax
  • Backward compatibility, stability, and easy to upgrade to future versions
  • Features of V programming
  • V as a framework
  • Operating systems V supports
By the end of this chapter, you will have learned about the V language and its features. You will also understand Vinix, an operating system (OS) written completely in V.
Let's begin our journey by understanding how V came into existence, who created it, and what its future is.

The past, present, and future of V

V is a new programming language created in early 2019 by Alexander Medvednikov. The creator has come up with an extensive vision for the V language and the features it offers. Therefore, the V language and its various features are undergoing heavy development. The official website is https://vlang.io/. The V programming language is open sourced and licensed under MIT. You can refer to the entire source code of V on its official GitHub repository at https://github.com/vlang/v.
V has an active community of developers and contributors. The community is highly active and responsive to issues raised on GitHub. You can participate in discussions at https://github.com/vlang/v/discussions and the team is also available on Discord: https://discord.gg/vlang.
V comes with a lot of performance optimizations that are on par with C compared to any other programming language, such as Go, Java, or Python to mention a few..
From version 0.3, V is expected to have the ability to translate C code to human readable V code. Also, you will be able to generate V wrappers on the top of C libraries.

V is a statically typed and compiled programming language

A programming language is designed to have certain typing and execution phenomena. Typing could refer to either statically typed or dynamically typed, while the execution phenomena could be referred to as compiled or interpreted. Let's look at these terms in more detail.

Statically typed versus dynamically typed

A programming language is referred to as statically typed when the type checking of the variables happens during compile time instead of runtime.
In a dynamically typed programming language, the types are determined during runtime based on the values assigned to the variables. The advantage of dynamically typed programming languages is that the programmers do not have to explicitly mention the type of variables while they code. This capability eases and speeds up development times.

Compiled versus interpreted languages

A programming language is said to be compiled when the code is directly translated into machine code or byte code. This phenomenon makes the resulting program run significantly faster in contrast to interpreted languages. V compiles ~1 million lines of code (LOCs) per CPU per second.
On the other hand, the term interpreted refers to programming languages where the interpreter runs the program by executing the commands line by line. And this phenomenon makes interpreted languages significantly slower than compiled languages.
The V programming language is a statically typed compiled programming language. So, the type checking in V happens during compile time itself. Also, when you build a V program, it generates an executable file as output that contains all the instructions written in the program translated into machine code.

Simple and maintainable syntax

As we've already learned, V is inspired by the Go programming language, and its design has also been influenced by Oberon, Rust, Swift, Kotlin, and Python. V comes with the simplest form of coding style when it comes to syntax and semantics. If you are a Go programmer, writing a program in V gives you an adrenaline rush because of the simplicity of the syntax. The syntactic simplicity offered by V lets beginners of this programming language learn quickly and understand the basics instead of trying to learn about the semantics.
V takes a similar or even fewer number of LOCs to mimic functionality written in Go. It has only one standard format for writing code, and this is managed by vfmt, a built-in library that helps format the code. vfmt strictly formats your code according to a globally unique coding standard across all V projects.
All it...

Table of contents