2009-03-15

Lei

Today I created a new project on Google Code for my new programming language, The Lei programming language. Lei introduces some of the more interesting concepts and structures that were developed for the Hula programming language in what will grow to be a practical implementation.

2008-12-17

Functions And Objects – The State Connection

I'm sure that many of you will disagree with me when I say this, and that's the beauty of opinion: there's always more than one.

If you've read by blog you'll know that I've been leaning towards object-oriented programming of late. With that in mind I'll try to leave my own personal bias out ;).



The universe in which we operate is inherently stateful. This is reflected in the languages that we use to write computer programs. This is simultaneously, the reason that functional programming and object-oriented programming exist… and the reason most people feel they're irreconcilably distinct.

I don't believe this to be the case.

In my not so humble opinion functional and object-oriented programming are as two sides of the same coin, trying to solve the same fundamental problems in opposing ways. While functional programming languages eschew state object-oriented programming languages attempt to make it manageable.

A language without side-effects (and the resulting state) would be pretty useless. In the end both object-oriented programming and functional programming languages are trying to manage the unavoidable!

The difference is in the how.

In object-oriented languages state is encapsulated using objects. In functional languages other approaches are used. Monads can be used to isolate such stateful regions of programs in Haskell.

So how are functional and object-oriented languages that different? There must be larger differences.

Perhaps the biggest difference is in the accepted feature set, but even this isn't as big a difference as it first appears. Many of the features assigned to functional programming have also been present in other paradigms for decades, and are not strictly indicative of the paradigm. Others are not limited to functional programming and may be applied in other paradigms.

Of course, the same can be said about any paradigm, including object-oriented programming.

Note: what many people see as adoption of functional programming through mainstream object-oriented languages is really just the reintroduction of features that were present in some of the first object-oriented languages. Thanks to the increased interest in functional programming! :)

To be clear, I'm not saying that functional programming has nothing to offer. The point of this post was to show that the differences are largely ideological. The disagreement about how state and side-effects should be managed is not a reason for us to fight as intensely as we have been recently.

We should help as much as much as we can. After all, we're going in the same direction.

On the other-hand, maybe I'm wrong?!


If you have any comments, corrections or contributions please feel free to shout.

2008-11-23

Newspeak Keynote At Smalltalk Solution 2008



If you can't tell Gilad Bracha is a hero of mine! In this excellent keynote from Smalltalk Solutions 2008 he introduces the Newspeak programming language. For those interested in following along the slides can be found here.

2008-08-20

Objects As Software Services



This wonderful talk by Gilad Bracha (an idol of mine) is truly eye opening, and like much of Brachas work this may be applicable to Hula at some point in the future!

If you haven't already check out his work on the Newspeak programming language I'd highly recommend it.

2008-07-17

Hula – The Unfinished Presentation (Version 2)

The second revision of the presentation is available here. I've added a few details on meta-programming, reflection and program organization in Hula, with some references and general improvements. There's still a lot to come but if you have anything specific you want covering just let me know.


If you have any comments, corrections or contributions please feel free to shout.

2008-07-12

Methods to Patterns

Explaining patterns is difficult. I suspect that the best way to explain them would be to describe their developed. In this article I’ll touch on the relationship between methods and patterns in the Hula programming language.


In most object-oriented languages the behaviour of an object is referred to as a method. A method can be thought of as a function. What makes a method distinct is how it relates to an object. A method is related to an object through a process known as dispatch. During dispatch the relevant definition is selected using the types of the arguments at hand.


Single Dispatch

Just about all object-oriented languages use single dispatch. In these languages a single argument is used in selecting the relevant definition. This makes writing methods that associate multiple objects a bit tedious.

Pseudo-syntax:

object method(...)


Multiple Dispatch

The more versatile multiple dispatch may be preferable, but is often dismissed as not being object-oriented enough, mainly because of the perceived syntactic requirements of object oriented languages. With multiple dispatch each argument is treated identically; that is, every argument is used in selecting the relevant definition.

Pseudo-syntax:

method(object ...)


Refined Dispatch

With standard dispatch the name of the method is usually specified using an identifier. This separation of identifiers and arguments presents some unfortunate restrictions.

Hula uses a unique refined multiple dispatch, which enables multiple dispatch on discrete objects. During a refined dispatch the identity of the arguments (not the type) is used to select the relevant definition. This allows objects to completely replace identifiers in the language, and is perhaps an order of magnitude more expressive!

Pseudo-syntax:


(method object ...)

or

(object method ...)

etc.

The resulting anonymous properties or behaviours above are referred to as patterns :).


As always if you have any comments, corrections or contributions please feel free to shout.

2008-07-08

Hula – The Unfinished Presentation (Version 1)

I've been working away trying to distill the contents of my various notebooks into something suitable for a presentation. I have a lot of notes so it's not finished yet but if you'd like to read it the pdf document is available here. I'm think this could take a while, but anyway, enjoy part one :).



If you have any comments, corrections or contributions please feel free to shout.