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”