Thursday, October 06, 2011

Dart/Smalltalk and dynamic object environments

I'm very interested what Dart (the new Google programming language) is all about. Why? Let me explain:

We have seen many new languages in the last few years (from Java, C#, Ruby, Scala, Clojure, Go, ...) - most of them with old and known concepts mixed with different syntax. But nothing really new. I tried nearly all of them but nothing hit me like Smalltalk did back when I understood all of its concepts.

To me Smalltalk is still outstanding since it is not only a language - it's language is only mapped to "the dynamic object system" underneath that the Smalltalk runtime provides. And having such a dynamic object system is the key factor in programming.

Many people are "blind" and dont see this since they compare languages by syntax or features or check if a language is highly ranked in silly comparisions like the TIOBE index. IMHO one of the reasons why Smalltalk is so poorly ranked is that Smalltalk (if seen as a programming language) maps to objects and messages - thats not what people know from other languages and if they look at Smalltalk code this is not what the usual programmer would expect regarding syntax.

Smalltalk is too different here. In a "3 + 4" expression the plus is not an operator - its a message. 3 and 4 are not treated equally - 3 is the receiver and 4 is the argument. Its also different regarding control structures. You dont need a keyword for a "while" loop in Smalltalk - you just need a message. If you dont have a "repeat until" construct you can easily implement it just by adding a message #repeatUntil: to BlockClosure taking a block as argument, ...

But there is this expectation among programmers to learn new keywords and syntax rules with any new programming language. This is how most books teaching programming languages start: learn the keywords, then language control structures and then start coding.
There is also this expectation to use nice wizards to create new classes or writing source code in text files followed by a compiler step.

Smalltalk is different: here you only need six keywords or just send a message to a class to tell the system that you want to create a new subclass of it. So anything is an object and understands messages - even classes and block/closures. Anything is changeable, anytime - even at runtime.

So Smalltalk as "a dynamic object system" is superior - and will continue to be so - since a dynamic environment is easy to change (even the language built on top). If you want you can even cleanly blend in different other more mainstream languages into this dynamic system. You can even make a snapshot of this virtual object system (an image file) and continue with your program or debugging session the next day.

Our world is a dynamic system too - full of objects. Thats why Smalltalk is very close in bringing real world concepts to machines and computing.

But even Smalltalk systems have to be enhanced - there is so much power in the meta facilities of these dynamic environments and Smalltalk still doesn use all of its power here. Meta informations usually are used for IDE tools - but if extended they can allow you to build applications nearly automatically (maybe more on this in another post). This is the field where Smalltalkers have to learn and catch up.

And what about Dart? The people behind Dart know that Smalltalk is not only a language, they worked with the underlying dynamic object system and understand it down to the bare metal. If they have reused and transfer this know how and knowledge correctly into the design of Dart then this new programming language is a chance to again bring dynamic object systems into the focus and raise programmers attention.

So will Dart just be "yet another language" with new books teaching you yet another new syntax or will it be a real step towards more dynamic adoptable and flexible runtime systems?

We will see next week...


Friedrich said...

I had havn't a look at Dart but have you looked at Io?

If not I suggest, have a look.

Torsten said...

Yes, but after a short look at IO I missed keyword messages ...