Above is a test of Smalltalk/DLR calling string properties and methods. The Smalltalk/DLR parser can now handle cascades, keyword messages and calls to compiled methods.
In the test shown above, “Transcript” is a global variable referencing the transcript window which is coded in C#. I am calling two public methods on the transcript:
- public void show(object msg)
– which prints “msg” to the window - public void cr()
– which adds a linefeed to the window
There are then several tests which reference properties and methods on a string.
Note that the string property “Length” is defined in the .Net class “String”. However, the methods that I am calling — “title”, “strip”, “swapcase”, “zfill” — are all IronPython methods.
The Dynamic Language Runtime (DLR) makes use of ”extension methods” which were introduced in C# 3.0. IronPython uses this capability with ”PythonExtensionTypes” to give strings (and other classes) additional Python methods. Over the next few days, I will start to define my own “SmalltalkExtensionTypes” for strings, integer, objects, etc. to add the appropriate Smalltalk methods.
So far, I have found that the DLR is quite easy to use. The next task is to add processing for Smalltalk blocks and classes to the compiler. With any luck, the compiler should be mostly complete sometime next week.

“The next task is to add processing for Smalltalk blocks and classes to the compiler. With any luck, the compiler should be mostly complete sometime next week.”
Sweet!
Comment by M. David Peterson — May 13, 2007 @ 9:27 pm