How Lapsang avoids two common forms of explicit casting

Lapsang logoI have recently been working on how Lapsang might support both static and dynamic composition. In the process of thinking about these topics though, I’ve come to realise what mammoth topics they are. For example, in OO languages, we take for granted that there is a base class – often Object – that can define things like toString(). Because all classes inherit from that base class, all have access to toString(). However, Lapsang does not allow class inheritance. Thus even simple things like a toString() method have to use composition in order to be universally available. So defining how static composition works is taking longer than I expected, and I haven’t even started thinking about dynamic composition! Whilst working on composition, I started thinking about casting and what the syntax might look like in Lapsang. This led me to question whether Lapsang can avoid explicit casting altogether. The conclusion was yes, it can completely avoid explicit casting, sort of… Continue reading “How Lapsang avoids two common forms of explicit casting”

Testing with Lapsang

Lapsang logoThis post is the second in a series of articles on the Lapsang language. This time round, I want to explore its Test-driven development/Behaviour-driven-development (TDD/BDD) features. As previously mentioned, Lapsang takes many ideas that are considered programming “best practice” and makes them features of the language. As you might therefore imagine, testing in Lapsang isn’t relegated to a mere framework. In fact, it’s not even just built into the language syntax. Lapsang takes testing as seriously as it can be taken, by treating the presence of untested code as a compilation error. So using TDD when developing Lapsang code isn’t just a good idea, it’s mandatory if you want the code to compile! Continue reading “Testing with Lapsang”

Lapsang: “design to interfaces” and “dependency injection” language features

Lapsang logo

In a previous post, I introduced the idea of Lapsang: a hypothetical language that sought to take various “best practices” of modern software engineering (or software craftsmanship, if you prefer) and support and enforce them within the language itself. This is the first of a series of articles that then seeks to show how these ideas might work in practice. In this article, I’ll focus mainly on how Lapsang might support the principles of “design to interfaces” and “dependency injection”. Continue reading “Lapsang: “design to interfaces” and “dependency injection” language features”

Lapsang: does the world need yet another programming language?

Lapsang logoIn every programmer, there is (or at least there ought to be) a budding language designer just waiting to get out. However, before you or I rush off and knock up yet another programming language, let’s take a quick trip to the world of the novel. Remember the phrase “everyone has a novel inside them”? It’s a often repeated phrase, yet to slightly misquote Russell Lynes, the true phrase probably ought to be “everyone has a novel inside them, and [in most cases] that’s the best place for it.” So maybe it’s a good thing that most programmers never express their inner language designer. Despite this, being a master of turning my back on good advice, I present to the world, Lapsang… Continue reading “Lapsang: does the world need yet another programming language?”

Structural typing, or did OO get interfaces wrong?

Lapsang logoLately I have been doing a lot of thinking about programming languages and how ideas change over time on what constitutes good language functionality. As I enjoy playing around with grammars and parsers, I naturally started thinking about the idea of designing a hypothetical language of my own and what form it would take. One area that I was keen to address is OO’s interfaces and inheritance. It’s a topic I’ve had many heated debates with various people over the past couple of years and so it seemed a natural place for me to start. As I was trying to work out how best to express my ideas, Microsoft launched TypeScript. It implements what I feel interfaces should have been all along and even gave me an “official” name for the technique: structural types. Continue reading “Structural typing, or did OO get interfaces wrong?”