Archive for the ‘Programming Languages’ Category


Consistency and Subtyping Orthogonality.

December 6, 2015

“Gradual typing can easily be integrated into the type system of an object-oriented language that already uses the subsumption rule to allow implicit up-casts with respect to subtyping. The main idea is that consistency and subtyping are orthogonal ideas that compose nicely.”


Whats Wrong with Object Orientation in PHP.

July 1, 2014

PHP copies the basic Implementation of OO from C++, a static language, and then , seemingly noticing that it is unnecessarily restrictive, allows escape means of magic methods.


Classes versus Modules

June 29, 2014

A class is a module n the sense that it is a unit of code reuse, and indeed the only one in many languages.
A module is potentially much more.
A class defines a type.
A module may define a number of types, and interfaces.

The disadvantage: modules are even less composable.


Object Orientation is Inherently Dynamic

June 29, 2014

Even in static and compiled languages, therefore the despatch of a method to an object needs to be decided at run time. This is true of C++, where the _vtable is used for runtime dispatch, and also if function oanguages, where variant types ……. a variable whose actual type is decided by its current value….are used for despatch.

This raises the question of whether the best way to add OO to a static language is minimally , as C++ does, or add a whole dynamic layer as Objective C does….and if you are going down the latter route, should the layers have different or .similar syntax? Id be inclined to go for a minimal difference.

How to glue a dynamic layer to a static layer? If static code is embedded in dynamic code, some kind of dynamic despatch will be needed based on runtime parameter values. ( I’m assuming the dynamic layer will have only duck typing)

Static types passed into an embedded dynamic call will have to have their values boxed. Returns from dynamic calls , including data fetched from dynamic storage, is tricked. It can’t .be reliably unboxed into a naturally typed value,….either a runtime error will have to be thrown, or iy will have to into a variant.


Orthogonality III Functions, Objects and the Expression Problem.

June 29, 2014

“Object-oriented languages are good when you have a fixed set of operations on things, and as your code evolves, you primarily add new things. This can be accomplished by adding new classes which implement existing methods, and the existing classes are left alone.Functional languages are good when you have a fixed set of things, and as your code evolves, you primarily add new operations on existing things. This can be accomplished by adding new functions which compute with existing data types, and the existing functions are left alone.When evolution goes the wrong way, you have problems:Adding a new operation to an object-oriented program may require editing many class definitions to add a new method.Adding a new kind of thing to a functional program may require editing many function definitions to add a new case.”


Whats Wrong with Shell Script

June 28, 2014

Efficiency could be better.

Poor support for numerical,operations and data structures, make the sh/bash family   a poor competitor with the php/perl/python/lua family.

1980s style procedural constructs only. No support for object orientation or functional programming.

Limited function return values…and certainly no multiple return values!

Inbuilt persistence (between runs) would be cool.

No convenient support for common systems programming patterns, such as retries and locks.

Ability to safely modify running programmes would be cool.





Orthogonality 2: Interfaces and Implementations, and the Question of what a Language is.

June 18, 2014

Prompted by a stack overflow questioner wondering whether Object and Class are orthogonal concepts. They’re not. What are orthogonal concepts are interface and implementation…indeed, allowing interface and implementation to vary independently, ie safe polymophism, is one of the aims of OOP.

One of my conclusions is that the OO languages most people are familiar with do not reveal the nature of OO clearly. The class-object system of C++, Java and smalltalk is a convience.. Classes define both interface and implementation, and allow re use of code through inheritance. It is convenient to have interface and implementation defined in the same place, since changes to interface generally require changes to implementation. The merging of interface and implementation has drawbacks too, such as causing unnecessary recompilation. The go programimg language is able to provide the bare bones of OO without classes.

My other conclusion is that people do not , but should. apply this desirable orthogonality to languages themselves. The language qua syntax is an interface to an engine that implements a compiler, or whatever.