The Dynamic of Dynamic Languages
Hi...
I did a talk on Dynamic Languages yesterday during the German launch event in Frankfurt. The room was crowded which shows me that there is a huge interest in this topic... (that one was easy ;-)
I got a lot of feedback (thanks) and wanted to react on some of it.
First I showed a few demos which concentrated more on the integration of IronRuby and the .net framework, secondly on the extensibility of the compiler itself.
Then I was asked to show the "Dynamic" of dynamic... well, maybe this is a nice example:
#Let us define a class B
#with one function called foo
class B
def foo
'Foo'
end
end
#Make an instance of B called myB
myB = B.new
#As expected calling foo works
puts myB.foo
#But: Ups Error... there is no bar
puts myB.bar
#So let us extend the class
class B
def bar
'Bar'
end
end
#Now the instance of this class 'knows' the new function and we can call it
puts myB.bar
I think the code is pretty self explaining.
Now, you can argue what is this (and more) good for??
Well, yesterday a posed the three paradigms of dynamic languages:
- Runtime over compile time: OK, this one is obviously fulfilled here ;-)
- Delay decisions: The agility and flexibility given by the language here is an enabler for delaying decisions in the process of developing an app. The functionality of an instance (or class) can be changed at any point.
- Cover implementation details: Once again this is an enabler here. Implementation details can be changed at any point. The runtime takes care of resolving the details.
I hope I was able to add the missing piece....
CU
0xff
Comments
- Anonymous
June 18, 2009
PingBack from http://barstoolsite.info/story.php?id=355