Archive for the ‘Programming language design’ Category

h1

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.”

h1

Two Dimensionalism

November 16, 2015

Complex systems have aspects, such as data storage and user interface, and and they also have features, such as billing and user authorisation. Features can potentially involve all aspects. Plugins are intended to implement features in a swappable way.

h1

Striped Wrapping

November 2, 2015

original_stripe-wrapping-paper
Wrapping can be thought of  adding a filter to the input of a procedure, and also the output.

The easy case is when the procedure is the outermost layer.

The problem of striped wrapping is how you do that to a procedure which is at in intermediate level of an already built  programme.

That is itself a part of the problem of plugins: how do you 1) add a component, that 2) effects every aspect of an existing system, without 3) rewriting the existing system.
Standard modules are supposed to implement only one aspect of a system, so plugins are a cross-cutting concern in relation to them. Complex systems have aspects, such as data storage and user interface, and and they also have features, such as billing and user authorisation. Features can potentially involve all aspects. Plugins are intended to implement features in a swappable way. (I call this two dimensionalism).

Class based object-orientation presents a bad way of freely adding features. If Class C inherits from class B which inherits from class A, you can’t interpolate — stripe — some 4th class in the chain without changing the existing code.

The currently fashionable technique of dependency injection is much better: major changes can be made by modifying the highest level of code alone. In a sense the top level of code is a kind of configuration.

Dependency injection is a variation on the call back mechanism. Another common (but contrasting) pattern for extending existing code without modifying it is the wrapper. Cleanly implemented wrappers require their own syntactic form.

h1

Functional Programming as the Next Step from Procedural Programming.

July 11, 2014

Procedural programming languages hide goto underneath for, if and while. Functional languages hide for, if and while underneath filter, map and reduce.

Object orientated languages hide case/switch underneath method calls.

h1

Hiding References…the next “Procedural Breakthrough”

July 11, 2014

The introduction of procedural programming was the largest step forward in the history of programming design.much more so that what Object Orientation The basic idea is you get rid of gotos. You do that by finding the non pathological cases and turning them into specialised structures.

References,(and particularly pointers, raw, machine level references)are the gotos of data. They can lead to a host problems, including circularity, and “dangling” (premature dereference ).

The process of getting rid of explicit references is similar to the process forgetting rid of gotos: identify the use cases, and replace them with special purpose constructs. (Of course, raw pointers will gave to be used somewhere down in the machinery, for the same reason that implied gotos will implement for, if and while in procedural languages)

Pointers are used to implement complex databstruxtures such as trees an linked lists in languages lke C, so one tranche of references can be got rid of by using flexible data containers.
The other main use is passing data out of subroutines. The safe pattern is to pass in a references from outer scope, for the subroutine to modify. This avoids the problems attendant on a subroutine passing out references to their local variables, which might have beendestroyed, leaving the pointer dangling.

Both those techniques are used in the new language Parasail.

One might wonder why it took so long to get rid of the “second goto”.

The rise of object orientation ameliorates the use of references to pass data out of a subroutine. “This” and “self” are effectively implicit references, when used in modifiers. And the rise of dynamic languages ameliorate the use if references to build dynamic structures,…dynamic languages often have references, but their programmers rarely need them.

h1

Orthogonality V: Fixed Message, Flexible Receiver, Fixed Receiver, Flexible Message.

July 10, 2014
h1

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.