
C++ requires many algorithms to be implemented in amortized constant time. I was curious about what this meant for vector insertion. To get started I first wrote an article about amortized time […]
C++ requires many algorithms to be implemented in amortized constant time. I was curious about what this meant for vector insertion. To get started I first wrote an article about amortized time […]
A staple of compact code, the ternary operator ?: feels like it’s earned a place any programming language. I use it often; you should use it often. However, I don’t like the […]
Variants are data types that can store different types of values in them, as opposed to one fixed type. In contrast to a generic object or an untyped variable, there is a […]
I needed a way to embed a text file in my C++ code. I recently introduced Leaf code into the Leaf compiler and didn’t want to depend on a file dependency at […]
I recently ported Leaf from Linux to OSX. I figured it was about time to start making it cross-platform. The goal is to get it compiling useful libraries for iOS and Android […]
In my previous article the mess of virtual functions, I show how easily they introduce bugs and propose language extensions to fix it. Several comments suggested an alternate solution with the “non-virtual […]
Virtual functions, though generally a blessing, have a defect-prone dark side. No language, that I know of, provides a way to encode when the base class should be called. This leads to […]
“Reference counting is slower than garbage collection”, a claim often made in the discussion of memory management. I heard it again recently when discussing Leaf; somebody took issue with my arguments against […]
Every day millions of programmers require the length of a string. Despite this there is no universal definition of what string.length actually represents. It changes between languages, and quite often doesn’t return […]
“Exceptions are bad because they introduce non-local flow into a program.” It’s an argument I’ve seen often and it even came up in the comments in my previous article. It’s nonsense though. […]
Unexpectedly I needed to add support for variable argument functions to Leaf long before I intended to. I just wanted to print out a value, but it turns out that the standard […]
In the world of parametric programming our languages often seem quite varied and unique. At the core however are two primary approaches, let’s call them templates and generics. In this article I’ll […]
C# prefers composition to inheritance yet lacks any concise composition syntax. This is unfortunate. While I have nothing against composition, I really don’t like the redundancy of manually forwarding methods. Here I […]
I like using enums and type hierarchies. What I don’t like is writing verbose switch statements to use them. In C++ I use macros to significantly reduce the burden of creating visitors. […]