It is important to write exception-safe code. A truly exception-safe function produces no side-effects when an error occurs. It returns to the caller with the exact state of the system as prior […]
Over 20 years of programming. From video games to communications; science to finance; compilers to business processes. Too many languages to even track anymore.
Here's looking to another 20 years towards mastery of the craft.
My previous article, “We don’t need a string type“, caused a bit of stir. Though the feedback is mixed, there is a common theme of a string being a useful feature. After […]
Variadic templates are a great new feature of C++, yet they can be a bit confusing. __VA_ARGS__ are also a nice feature of the preprocessor, yet it has a few oddities. These […]
I’m working on modules in Leaf, implementing namespace support. The moment I write my first test a feeling of uneasiness sets in. As I stare at the sample code I see a […]
Exceptions are a cornerstone of programming. If we intend to use them prolifically, as in C++, we need an efficient implementation. Thus was born the zero-cost exception model. It offers zero runtime […]
Should string be a distinct type or merely an alias for an array of characters? I’m considering the options for Leaf and can’t convince myself that a specialized type is needed. Looking […]
Obtaining a ‘shared_ptr’ from ‘this’ is possible using the ‘enable_shared_from_this’ class. It’s a feature that allows a class to reference itself within a smart pointer based API. Beware an ugly implementation detail […]
Smart pointers in C++ are nice, yet fraught with irregularities. One is the inability to create a proper clone function. This requires a feature called covariant return types, which C++ supports, but […]
How is an overloaded function compiled? It’s not something I truly considered prior to writing Leaf. My first implementation mimicked C++, at least how they appear to behave in C++. It worked, […]
I previously contemplated elimination of the ternary conditional operator, but now I have a solution that retains and improves it. My biggest concern here is having a single unifying conditional logic. I […]
I’m reconsidering the necessity of the conditional ternary operator in Leaf. I’m having troubles coming up with a comfortable, flexible, and unambiguous syntax. The traditional short ‘cond ? true_value : false_value’ syntax […]
A question recently asked why a ‘constexpr’ function in C++ may comprise only a return statement. It’s a good question. On quick glance the restriction seems somewhat arbitrary, and indeed quite limiting. […]
A language’s type hierarchy is formed with both linking and attributes. But what if a uniform hierarchy is not the correct way to represent a type? In Leaf I’m about to refactor […]
I’m in the midst of reworking a significant aspect of the type system in Leaf. It’s a lot of work, and I’d like to avoid doing it too many times. I need […]