About this ‘A Language a Day’ Advent Calendar 2019 Welcome to Day 6 of this year’s A Language a Day Advent Calendar. Today’s topic is introduction to the Crystal programming language. Table of Contents Facts about the languageInstalling and running CrystalVariablesFunctionsProcClassesGetters and settersClass variablesInheritanceConcurrent computationGet more Facts about the language Some facts about Crystal Based on … Continue reading “Crystal at a Glance — A Language a Day, Advent Calendar 2019 Day 6/24”
Modern C++ at a Glance — A Language a Day, Advent Calendar 2019 Day 5/24
About this ‘A Language a Day’ Advent Calendar 2019 Welcome to Day 5 of this year’s A Language a Day Advent Calendar. Today’s topic is an overview of the very-well updated C++ programming language. C++ feels like a new languageB. Straustrup, A Tour of C++ You may reasonably ask what’s up with C++? It appeared about … Continue reading “Modern C++ at a Glance — A Language a Day, Advent Calendar 2019 Day 5/24”
Kotlin at a Glance — A Language a Day, Advent Calendar 2019 Day 4/24
About this ‘A Language a Day’ Advent Calendar 2019 Welcome to Day 4 of this year’s A Language a Day Advent Calendar. Today’s topic is introduction to the Kotlin programming language. Table of Contents Facts about the languageInstalling and running KotlinVariablesFunctionsLambdasClassesObjectsGetters and settersInheritanceCoroutinesGet more Facts about the language Some facts about the Kotlin programming language: It … Continue reading “Kotlin at a Glance — A Language a Day, Advent Calendar 2019 Day 4/24”
Julia at a Glance — A Language a Day, Advent Calendar 2019 Day 3/24
About this ‘A Language a Day’ Advent Calendar 2019 Welcome to Day 3 of this year’s A Language a Day Advent Calendar. Today’s topic is introduction to the Julia programming language. Table of Contents Facts about the languageInstalling and running JuliaVariablesIdentifiersA note about numbersFunctionsType annotationLambdasMultiple dispatchFunctions changing their argumentsComposite typesConcurrency and parallelismChannelsGet more Facts about the … Continue reading “Julia at a Glance — A Language a Day, Advent Calendar 2019 Day 3/24”
Rust at a Glance — A Language a Day, Advent Calendar 2019 Day 2/24
About this ‘A Language a Day’ Advent Calendar 2019 Welcome to Day 2 of this year’s A Language a Day Advent Calendar. Today’s topic is introduction to the Rust programming language. Table of Contents Facts about the languageInstalling and Running RustVariablesFunctionsMacrosObject-oriented featuresError handlingFile not foundConcurrencyGet more Facts about the language Some facts about Rust: Syntactically close … Continue reading “Rust at a Glance — A Language a Day, Advent Calendar 2019 Day 2/24”
TypeScript at a Glance — A Language a Day, Advent Calendar 2019 Day 1/24
About this ‘A Language a Day’ Advent Calendar 2019 Welcome to Day 1 of this year’s A Language a Day Advent Calendar. Today’s topic is introduction to the TypeScript programming language. Table of Contents Facts about the languageInstalling and running TypeScriptVariablesFunctionsOptional and defaults parametersLambdasClassesInterfacesError handlingAsynchronous computingGet more Facts about the language Some facts about TypeScript: TypeScript … Continue reading “TypeScript at a Glance — A Language a Day, Advent Calendar 2019 Day 1/24”
‘A Language a Day’ — Advent Calendar 2019
Welcome to my Advent Calendar 2019. Last year, I was publishing daily articles about one-liners in Raku. This year, I decided to spend time on filling the gap in other areas and try as many other languages as possible. During the last decade or so, a lot of programming languages appeared. Some of them are … Continue reading “‘A Language a Day’ — Advent Calendar 2019”
The Raku stand at FOSDEM 2020
A few weeks ago, I submitted a booth request for promoting the Raku programming language at the next year’s FOSDEM in Brussels (1–2 February 2020). Just got a confirmation that the stand is accepted. More details of whether it is a 2-day stand or it is only there on Saturday or on Sunday, and where … Continue reading “The Raku stand at FOSDEM 2020”
Initializer lists in C++
Initializer lists, or if you prefer, initialiser lists, are a great addition of C++ 11, which allows you to 1) initialize your list-like classes and 2) uniform the initialisation of such objects comparing to what you can do with the built-in types. Let us demonstrate it on the following example, which uses a simple array … Continue reading “Initializer lists in C++”
Avoiding naked new in modern C++
The old-days way of acquiring memory resources is to have a pair of malloc and free calls. The C++’s addition, the new and delete keywords simplified the syntax, but did not eliminate the problem of proper memory management. The Problem Here is a typical approach: you create some place for your data, get a pointer, … Continue reading “Avoiding naked new in modern C++”
Concurrent atomic operations in C++ and Raku
Here’s a problem to solve: you have two threads, each incrementing the same single counter N times. What is the state of the counter at the end of the program? A straightforward solution A naïve C++ program can be written using the standard library threads like this: #include <iostream> #include <thread> int counter; void f() { for (int c = 0; c != 100000; c++) counter++; } int main() { std::thread thread_a {f}; … Continue reading “Concurrent atomic operations in C++ and Raku”
Iterators vs. auto in C++
The range-based for loop that is available since the C++ 11 standard, is a wonderful mean of making the code compact and clean. This post is totally dedicated to a single go: to show the difference between iterating using STL iterators and using for ranges. Here’s a simple code that creates a vector of integers … Continue reading “Iterators vs. auto in C++”
A range-for loop in C++
The so-called range-based for loop appeared in the C++ 11 standard, together with the auto keyword gives us a very powerful and idiomatic way of looping over things. Let’s start with a simple array. #include <iostream> int main() { int odd_data[] = {1, 3, 5, 7, 9}; for (auto x : odd_data) std::cout << x << “\n”; } Here, the for loop goes over all the elements of the odd_data array, and you … Continue reading “A range-for loop in C++”
constexpr in C++ 11 and C++ 14
In the previous post, we were talking about the constexpr keyword in modern C++. It was added to the C++ 11 standard, but in C++ 14, it got a very nice addition. In particular, you can do more in constexpr functions now. Consider the following program that wants to pre-compute a factorial of 5. #include <iostream> … Continue reading “constexpr in C++ 11 and C++ 14”
constexpr in C++
The constexpr keyword is a relatively new addition to C++. You need to use the C++11 standard in order to compile the following programs: g++ -std=c++11 test.cpp Let’s examine what the keyword is about. There’s no difficulty to split it into words to get the meaning: constant expression. In practice, constant expression means that the … Continue reading “constexpr in C++”
Raku One-Liners — a free book
Let me announce the new book, Raku One-Liners. Electronic editionAmazon Kindle Paperback editionsAmazon.com, Amazon.de (and also on other local Amazon sites) The book is available in the PDF format for free. Paperback copies are available on Amazon. Download the Raku One-Liners book now N.B. As of today, the book is in the test mode, and … Continue reading “Raku One-Liners — a free book”
🦋 110. is rw vs is raw in Raku
The cryptic title should not stop you from seeing bits of the regular Raku code. Namely, the two traits that you can add to function arguments: is rw and is raw. These two traits may look confusing because both allow changing the passed variable: sub f1($x is rw) { say $x; } sub f2($x is raw) { say $x; } my $a = 42; f1($a); # 42 f2($a); … Continue reading “🦋 110. is rw vs is raw in Raku”
Using Raku — a free book
Let me announce the second edition of my Using Perl 6 book. This time, it is published under the new name, Using Raku. Electronic editionLeanPubAmazon Kindle Paperback editionsAmazon.com, Amazon.de (and also on other local Amazon sites) The book is available in the PDF format for free. Paperback copies are available on Amazon. Download the Using Raku book … Continue reading “Using Raku — a free book”
OK, Raku
So, Larry Wall agreed to rename Perl 6 to Raku. Here’s the quote with a nested quote in it: I am in favor of this change, because it reflects an ancient wisdom: “No one sews a patch of unshrunk cloth on an old garment, for the patch will pull away from the garment, making the … Continue reading “OK, Raku”
On renaming Perl 6
In short: I am against renaming. The longer story Once in a while, another round of the non-ending battle starts, and this time, unfortunately, I was the one who allowed to start it from a public stage. There were a lot of noise around the keynote speakers of PerlCon 2019 in Riga, and in the … Continue reading “On renaming Perl 6”