ENGLISH

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

Book information

Publisher
Packt Publishing
Year
2021
ISBN
1839213434, 9781839213434
Language
english
Format
PDF
Filesize
5 MB (5368231 bytes)
Edition
1
Pages
408\408
Time added
2021-12-13 09:58:54

Description

Learn a new statically compiled programming language to build maintainable and fast software with the help of this comprehensive guide to V programming Key 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 seconds Book Description A 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 Understand best practices of sharing memory by letting coroutines communicate with each other using channels in V 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 V Who this book is for Whether 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. Table of Contents Introduction to V Programming Installing V Programming Variables, Constants and Code Comments Primitive Data Types Arrays and Maps Conditionals and Iterative Statements Functions Structs Modules Concurrency Channels: An advanced concurrency pattern Testing Introduction to JSON and ORM Building a Microservice Cover Title Page Copyright and Credits Contributors Table of Contents Preface Section 1: Introduction to the V Programming Language Chapter 1: Introduction to V Programming 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 Performance Speed No null values No global variables No undefined values Error handling Powerful concurrency Easy cross-compilation V to JavaScript conversion Profiling V as a framework Memory management using the autofree engine Inbuilt ORM Built-in web server Native cross-platform GUI library Vinix – an OS kernel written in V Operating systems V supports Summary Chapter 2: Installing V Programming Technical requirements Installing V on the Windows OS Approach 1 – installing V from portable binaries on the Windows OS Approach 2 – installing V from source on the Windows OS Adding V to the environment variables in the Windows OS Accessing V programming using a REPL Installing V on the Linux OS (Ubuntu) Using Symlink V to make V accessible globally in Ubuntu Summary Section 2: Basics of V Programming Chapter 3: Variables, Constants, and Code Comments Technical requirements Understanding variables in V The variable naming convention Variable assignment Features of variables in V The limitations of variables in V Working with constants in V Naming conventions for constants Defining constants Defining complex constants Best practices when working with constants Variables versus constants Adding code comments in V Single-line comments Multiline comments Summary Chapter 4: Primitive Data Types Technical requirements Introducing primitive data types The Boolean data type Logical operators Relational operators Numeric data types Signed and unsigned integers Floating-point types Promoting numeric types Operations on numeric data types Arithmetic operators Bitwise operators Shift operators The string data type Working with the string data type The rune data type Operations on the string data type String interpolation String manipulation techniques Summary Chapter 5: Arrays and Maps Technical references Arrays Different methods to declare arrays Working with the len and cap array properties Accessing array elements using the index Accessing array elements using slices Operators used with arrays Fixed-size arrays Multidimensional arrays Performing various operations on an array Maps The explicit initialization of a map The short syntax initialization of a map The count of key-value pairs in a map Retrieving a value given the key of a map Accessing a non-existent key from a map Handling the retrieval of missing keys in a map Updating the value of the key in a map Deleting a key-value pair from a map Summary Chapter 6: Conditionals and Iterative Statements Technical requirements Conditional blocks The if statement match Iterative statements A for loop on maps A for loop on arrays A for loop without an index on the array A traditional C-style for loop A reverse for loop A for loop on a range A bare for loop or an infinite for loop Using break in a for loop Using continue in a for loop Using the continue and break statements with labels Summary Chapter 7: Functions Technical requirements Introducing functions Understanding function types The main function Basic functions Anonymous functions Higher-order functions Understanding function features Functions can return values or simply perform operations Functions can take zero or more input arguments Functions can return multiple values Ignoring return values from functions Functions can call other accessible functions Functions allow only arrays, interfaces, maps, pointers, and structs as mutable arguments Function declarations in script mode should come before all script statements Functions do not allow access to module variables or global variables Functions do not allow default or optional arguments Functions can have optional return types Functions are private by default and can be exposed to other modules using the pub access modifier keyword Functions allow you to defer the execution flow using the defer block Functions can be represented as elements of an array or a map Summary Chapter 8: Structs Technical requirements Introducing structs Defining a struct Initializing a struct Accessing the fields of a struct Understanding heap structs Updating the fields of a struct Approaches to defining struct fields Adding multiple mutable fields to a struct Grouping fields in a struct using access modifiers Defining required fields in a struct Defining struct fields with default values Defining methods for a struct Adding a struct as a field inside another struct Modifying the fields of struct type inside another struct Structs as trailing literal arguments to a function Summary Chapter 9: Modules Technical requirements Introducing modules The syntax to define a module The syntax to import a module Working with modules Creating a simple V project Creating a module Importing a module Accessing members of a module Working with multiple files in a module Member scope in the module Implications of cyclic imports The init function for a module Accessing the constants of a module Accessing structs and embedded structs of a module Summary Section 3: Advanced Concepts in V Programming Chapter 10: Concurrency Technical requirements Introducing concurrency Understanding parallelism Learning the basic terminology Getting started with concurrency Understanding the time module Understanding the thread type Implementing concurrency in V The go keyword syntax Spawning a void function to run concurrently Waiting on a concurrent thread Implementing a real-life concurrency scenario programmatically Running multiple tasks in a sequence Spawning multiple tasks to run concurrently Comparing sequential and concurrent program runtimes Learning different approaches to implement concurrent programs Spawning functions with return values to run concurrently Spawning anonymous functions to run concurrently Sharing data between the main thread and concurrent tasks Summary Chapter 11: Channels – An Advanced Concurrency Pattern Technical requirements Syntax to define a channel Unbuffered channel Buffered channel Channel operations Arrow operator

Similar books

Session C11: Ancient Cultural Landscapes in South Europe – their Ecological Setting and Evolution, Session C22: Gardeners from South America, Session S04: Agro-Pastoralism and Early Metallurgy Sessions, Session WS29: The Idea of Enclosure in Recent Iberian Prehistory, Session C88: Rhytmes et causalites des dynamiques de l'anthropisation en Europe entre 6500 ET 500 BC: Hypotheses socio-culturelles et/ou climatiques: Proceedings of the XV UISPP World Congress (Lisbon 4-9 September 2006) / Actes du XV Congrès Mondial (Lisbonne 4-9 Septembre 2006) Vol.36

Session C11: Ancient Cultural Landscapes in South Europe – their Ecological Setting and Evolution, Session C22: Gardeners from South America, Session S04: Agro-Pastoralism and Early Metallurgy Sessions, Session WS29: The Idea of Enclosure in Recent Iberian Prehistory, Session C88: Rhytmes et causalites des dynamiques de l'anthropisation en Europe entre 6500 ET 500 BC: Hypotheses socio-culturelles et/ou climatiques: Proceedings of the XV UISPP World Congress (Lisbon 4-9 September 2006) / Actes du XV Congrès Mondial (Lisbonne 4-9 Septembre 2006) Vol.36

2010 · PDF

THE BRITISH ARMY IN INDIA: ITS PRESERVATION BY AN APPROPRIATE CLOTHING, HOUSING, LOCATING, RECREATIVE EMPLOYMENT, AND HOPEFUL ENCOURAGEMENT OF THE TROOPS. with AN APPENDIX ON INDIA : THE CLIMATE OP ITS HILLS ; THE DEVELOPMENT OF ITS RESODRCBS, INDUSTRY, AND ARTS ; THE ADMINISTRATION OF JUSTICE ; THE BLACK ACT ; THE PROGRESS OF CHRISTIANITY ; THE TRAFFIC IN OPIUM ; THE VALUE OF INDIA ; PERMANENT CAUSES OF DISAFFECTION, AND OF THE RECENT REBELLION ; THE TRADITIONARY POLICY; MISGOVERNMENT BY NATIVE RULERS ; ANNEXATIONS OF THEIR TERRITORY, ETC.

THE BRITISH ARMY IN INDIA: ITS PRESERVATION BY AN APPROPRIATE CLOTHING, HOUSING, LOCATING, RECREATIVE EMPLOYMENT, AND HOPEFUL ENCOURAGEMENT OF THE TROOPS. with AN APPENDIX ON INDIA : THE CLIMATE OP ITS HILLS ; THE DEVELOPMENT OF ITS RESODRCBS, INDUSTRY, AND ARTS ; THE ADMINISTRATION OF JUSTICE ; THE BLACK ACT ; THE PROGRESS OF CHRISTIANITY ; THE TRAFFIC IN OPIUM ; THE VALUE OF INDIA ; PERMANENT CAUSES OF DISAFFECTION, AND OF THE RECENT REBELLION ; THE TRADITIONARY POLICY; MISGOVERNMENT BY NATIVE RULERS ; ANNEXATIONS OF THEIR TERRITORY, ETC.

1858 · PDF

Idries Shah 27 Books Collection : A Perfumed Scorpion, A Veiled Gazelle, Caravan of Dreams, Darkest England, Destination Mecca, Evenings with Idries Shah, Knowing How to Know, Learning How to Learn, Letters and Lectures of Idries Shah, Neglected aspects of Sufi study, Observations, Oriental Magic, Reflections, Seeker after Truth, Special Illumination, Special Problems in the study of Sufi ideas, Sufi thought and action, Tales of the Dervishes, The Dermis Probe, The Elephant in the Dark, The Englishman Handbook, Idries Shah Antology, The Magic Monastery, The natives are restless, wisdom of the Idiots PDF.

Idries Shah 27 Books Collection : A Perfumed Scorpion, A Veiled Gazelle, Caravan of Dreams, Darkest England, Destination Mecca, Evenings with Idries Shah, Knowing How to Know, Learning How to Learn, Letters and Lectures of Idries Shah, Neglected aspects of Sufi study, Observations, Oriental Magic, Reflections, Seeker after Truth, Special Illumination, Special Problems in the study of Sufi ideas, Sufi thought and action, Tales of the Dervishes, The Dermis Probe, The Elephant in the Dark, The Englishman Handbook, Idries Shah Antology, The Magic Monastery, The natives are restless, wisdom of the Idiots PDF.

2022 · PDF

The travels of Capts. Lewis and Clarke from St. Louis, by way of the Missouri and Columbia rivers, to the Pacific ocean; performed in the years 1804, 1805 & 1806, by order of the government of the United States. Containing delineations of the manners, customs, religion, &c. of the Indians, comp. from various authentic sources, and original documents, and a summary of the Statistical view of the Indian nations, from the official communication of Meriwether Lewis. Illustrated with a map of the country, inhabited by the western tribes of Indians

The travels of Capts. Lewis and Clarke from St. Louis, by way of the Missouri and Columbia rivers, to the Pacific ocean; performed in the years 1804, 1805 & 1806, by order of the government of the United States. Containing delineations of the manners, customs, religion, &c. of the Indians, comp. from various authentic sources, and original documents, and a summary of the Statistical view of the Indian nations, from the official communication of Meriwether Lewis. Illustrated with a map of the country, inhabited by the western tribes of Indians

1809 · PDF