Take a peak at the making of a secure yet invertible function. It's relatively simple using block encryption with Feistel networks. You'll use an exclusive OR operation (XOR), which happens to be its own inverse, to create a revolving door of encrypted blocks.
Modules, coroutines, concepts, and ranges, oh my. Here comes C++ 20. The big four new features are getting all the buzz, but what about the smaller features? It may surprise you to learn what unspoken features like spaceship operators and template parameter lists on lambdas can do for you.
Presenting a new technique to implement runtime polymorphism. Take a journey as we play with std::variant to make it possible to have heterogeneous collections and call functions in a way similar to virtual functions. But is std::variant-based polymorphism better "virtual" polymorphism? That is the question.
Are you ready for some
return magic? In a universe where functions can be used as types, the originator of the QED language shares secrets of the return() call. See how
return transforms itself from a keyword to a plain nested function that can be invoked multiple times, which comes in handy for things like spawning events and asynchronous functions.
C++ is a popular and powerful language, but with many ways for code to go horribly wrong. Take the case of overloading the comma operator. You can use comma operator overloads to append data to an existing vector. However, what happens when you define the comma operator as a free function instead of a member function? It compiles, but then results in a silent failure! See if you can figure out what went wrong.
Make quality cheap enough, and good software will naturally follow—that is the promise of property-based software testing. While unit tests fall short due to scaling issues, property tests serve to test whether code ever crashes for any argument. In this article, you'll learn about testing methods that make use of deterministic randomness and shrinking to find incorrect code that you never even considered.
Extension points and AST rewriters are the OCaml answer to metaprogramming. You'll feel at ease diving right in to developing rewriters using OCaml PreProcessor eXtensions (PPX). Get your feet wet by writing a simple extension that replaces a string with its uppercase version. Then dive deeper by building an expander. Finally, explore some existing extension points and popular libraries that showcase the flexibility and power of PPX.
Map, filter, reduce: the bread and butter of manipulating data collections. In the last installment, we looked at sequence abstraction and the map operation. Now we'll take a closer look at filter and reduce and build a mini data pipeline in Clojure that combines map, filter, and reduce.