Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Getting Started with V Programming

You're reading from   Getting Started with V Programming An end-to-end guide to adopting the V language from basic variables and modules to advanced concurrency

Arrow left icon
Product type Paperback
Published in Dec 2021
Publisher Packt
ISBN-13 9781839213434
Length 408 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Navule Pavan Kumar Rao Navule Pavan Kumar Rao
Author Profile Icon Navule Pavan Kumar Rao
Navule Pavan Kumar Rao
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

Preface 1. Section 1: Introduction to the V Programming Language
2. Chapter 1: Introduction to V Programming FREE CHAPTER 3. Chapter 2: Installing V Programming 4. Section 2: Basics of V Programming
5. Chapter 3: Variables, Constants, and Code Comments 6. Chapter 4: Primitive Data Types 7. Chapter 5: Arrays and Maps 8. Chapter 6: Conditionals and Iterative Statements 9. Chapter 7: Functions 10. Chapter 8: Structs 11. Chapter 9: Modules 12. Section 3: Advanced Concepts in V Programming
13. Chapter 10: Concurrency 14. Chapter 11: Channels – An Advanced Concurrency Pattern 15. Chapter 12: Testing 16. Chapter 13: Introduction to JSON and ORM 17. Chapter 14: Building a Microservice 18. Other Books You May Enjoy

V as a framework

With the suite of packages V comes with, it can be considered equivalent to a framework. A framework generally comprises all the features of full-blown programming, along with the ability to smoothly plug and play the external packages. Using V, you can write enterprise-grade software, even though it is still in development. In the following sections of this chapter, we will look at the various suites of libraries and features that are written and implemented using V, which will help us build robust software applications.

Memory management using the autofree engine

V offers robust memory management with automatic garbage collection capabilities. Most of the objects are freed by V's autofree engine. Starting with V version 0.3, the autofree engine is enabled by default. You can also forcefully enable the autofree engine using the -autofree flag.

With the help of the autofree engine, the V compiler invokes the necessary calls to automatically free up objects during compilation. A small fraction of the objects is released from memory via reference counting. V also offers the ability to turn off the automatic garbage collection capability with the help of the -noautofree flag.

Built-in ORM

It is unlikely that a programming language will be available with a built-in Object Relational Mapper (ORM ), but V is. Though the orm library is in an alpha state at the time of writing this book, it has all the basic features, which are enough to implement data-driven applications that have relational databases as backends.

Currently, the orm library supports SQLite, MySQL, and Postgres and has planned support for popular relational databases such as MS SQL and Oracle.

The built-in orm eases the development time by offering you the standard V-based queries to interact with all the aforementioned relational databases. You will learn more about ORM in Chapter 13, Introduction to JSON and ORM.

Built-in web server

The vweb web server is a built-in library. Though it is in an alpha state at the time of writing this book, it offers various features in its current state, including the following:

  • Built-in routing.
  • Handling parameters.
  • Templating engine.
  • Very fast performance, like C on the web.
  • Building the project using vweb generates a single binary, thus simplifying deployments.

You will learn how to implement a microservice with RESTful endpoints using vweb, along with other libraries such as orm and json, in Chapter 14, Building a Microservice.

Native cross-platform GUI library

V has a cross-platform ui library. Using this library, you can leverage the power of building cross-platform GUI applications. The ui library can be found at the official GitHub repository at https://github.com/vlang/ui, which is licensed under GPL 3.0.

V has a ui module that uses native GUI toolkits: WinAPI/GDI+ on Windows and Cocoa on macOS. On Linux, custom drawing is used.

Vinix – an OS kernel written in V

Vinix is an effort to write a modern, fast, and useful OS using V. Vinix is purposefully built to facilitate writing low-level software.

The Vinix OS is licensed under GPL 2.0, and you can find its entire source code on its official GitHub repository at https://github.com/vlang/vinix. You can always download the latest version of the Vinix OS in the form of ISO from the official link: https://builds.vinix-os.org/repos/files/vinix/latest/vinix.iso.

Vinix aims to have the following features:

  • Make a usable OS that can run on emulators, virtual machines, and physical hardware
  • Target modern 64-bit architectures, CPU features, and multi-core computing
  • Maintain good source-level compatibility with Linux, which helps with porting programs between Vinix and Linux
  • Explore V's capabilities in bare-metal programming
  • Improve the compiler in response to the uncommon needs of bare-metal programming
You have been reading a chapter from
Getting Started with V Programming
Published in: Dec 2021
Publisher: Packt
ISBN-13: 9781839213434
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image