Functional Languages Discussion by Joe, Odersky & Don Syme
infoq.com
infoq.com
The impression Erlang gives me is one of being almost an anti-language, emphasising the system at large and discouraging over sophistication in the details. I think the point Joe Armstrong makes about hardware interoperability is telling. His vision of software is one much closer to hardware and the networking. Though I think the fact that there is an awful lot of unnecessary complexity in software it does not mean that sophistication and complexity is not sometimes necessary. Not that he ever voiced that, just sometimes in the process of advocating something pluralism can get left out.
The only agreement seems to be around "polymorphing" -- the ability to define a behaviour that works consistently over many "things" that share some similarities. Good.
But the root of evil comes back to very initial definition of what an object is:
An "object" is something very concrete, it is not a mere "thing", it has: - an identity - a state - a behaviour
Is a "hello" an object? No, no more than 9 or any number is an object, because these beasts are "values".
However, the way a string is implemented is probably an object at some level (this is not true of a number, CPUs can deal with them directly). But this is an implementation detail.
Unfortunately the essential difference between what is a Value and what is an Object is poorly promoted/teached. But this is improving thanks to functional languages.
In a perfect world there would be "things", that are either "values" or "objects". In the imperfect world of us we have "objects", that are more or less mutable.
This seems to be strongly debated (still). Languages like Ruby (and Smalltalk) treat numbers as objects. You can argue that numbers are really objects with immutable state for example.
This is not to say that I disagree with what you are saying. But the topic itself is still debated (as is a lot of stuff about the theory and basics of object systems)
What is a table.
For sure, it is thing. And for sure it is an object too.
What is "the plan to build a table" For sure it is something, hence it is a thing.
But is it an object?
Well, if the plan is printed on a piece of paper, then for sure it is an object. OTOH, if the plan for the table is in the head of some designer, then it is not an object, it's... an idea.
So basically, you have two planes (at least), the "physical plane", where object lie, very tangible, very concreate, and the "idea plane" where ideas lie, very abstract.
So, is 9 an object or and idea?
In CS, things that lie in the "idea plan" are called "values". That's probably because we don't hold it (yet) that computers can have ideas ;)
See also http://virteal.com/ObjectVersusValue
I am influenced by this paper -> http://www.cs.utexas.edu/users/wcook/papers/OOPvsADT/CookOOP... (warning: PDF), which expresses more carefully and precisely what I in the above paragraph expressed sloppily.
Clojure, for one, encourages the distinction between data structures that represent the programming domain, and data structures that represent the application domain.
There's defrecord, which goes a little further than record structures in other languages, in that it also gives the benefit of type-driven polymorphism.
Late-binding via message-passing pretty much covers it, IMHO. Structure code as a group of autonomous actors communicating by passing messages according to agreed-upon protocols, and each (polymorphically) chooses how to react to them. Erlang implements that model with unusual clarity, IMHO.
* Neither are prototypes.
Object -> Object' -> Object'' -> Object''' -> ...
The real problem with some popular OO languages is the conflation of state and identity. There are OO languages that avoid this "Worse Is Better" design.Haskell and Clojure come to mind.
> Joe Armstrong: What I’d like to see and we don’t do is integrate the language within the revision control system because if you rename a variable, and you submit it to the revision control system and say "This is a completely different version of a completely different program but you just rely on the variable because there is no semantics at all just to make it a little bit more readable if you correct a spelling mistake in a comment." The revision control system is a sort of generic and applied to any programming language and that’s really stupid. They need to be much more smart to check what really happening, not this superficial stuff.
> Don Syme: So we’ll have Erlang RCS, Erlang specialized?
Early on, Joe Armstrong talks about Erlang being "object oriented". I don't really agree though, because by the time you actually get processes and things put together - especially with OTP - you have a lot of other stuff running underneath, so you're not just operating at a 'pure' level of sending messages back and forth. And there's lots of boilerplate too. However, it's still a good way of thinking about Erlang from an architectural point of view.