February 12, 2003?This month, SmallScript Corp.will debut a new .NET language: S#. S# gives the .NET platform its first Smalltalk implementation, and adds formidable new capabilities to the .NET language family.
Think way back?back in the ur-ages of OOP development?and one language probably comes to mind before any other: Smalltalk. Even though it was one of the world’s first true object-oriented programming systems, Smalltalk’s technical underpinnings have survived to the present, and you can see its influence in the object models of both Java and .NET. For example, Smalltalk introduced the idea that all data types in a programming environment are objects, including even base scalar data types, such as Integers and Strings.
In an exclusive interview with DevX Wednesday in San Francisco, David Simmons, SmallScript Corp.’s Chief Technology Officer, chief architect of S#, and a seminal force in the Smalltalk community, related the story of the ups and downs of Smalltalk in the 90s as well as the creation of S#. He has been building commercial Smalltalk implementations since 1981.
Simmons related how Smalltalk’s star rose rapidly during the late ’80s and early ’90s, particularly among organizations building large financial systems, but fell equally quickly as infighting and standardization efforts stymied language advancements, and the advent of newer and lower-priced OOP languages, such as Java, eroded Smalltalk’s market share.
Despite Smalltalk’s fall in popularity, the reasons behind its original success remain?and Simmons says that Smalltalk is making a comeback; primarily among those same organizations, many of which are resurrecting their Smalltalk projects after failed attempts to move them to Java/J2EE implementations.
What is S#?
Innumerable pundits and programmers have pointed out the similarities between the most popular .NET languages (currently VB.NET and C#), and some like to focus on the relatively minor differences between them. S# is different. Not only is its syntax different, following the model of classic Smalltalks, but its underlying design and capabilities differ as well.
In 1999, Simmons was invited along with experts in 10 to 15 other languages, to join a then-secret project at Microsoft called Project 7 Lightning. Project 7 Lightening involved creating test implementations of these languages on the nascent .NET Framework codebase to help Microsoft discover what features the framework needed to fully implement these languages in the future.
Simmons said that he has tried to maintain the capabilities of classic Smalltalk in S#, while also giving S# all the advantages that other .NET languages enjoy. “My goal, and one of the reasons why its taken a long time to build [S#], is I didn’t want to sacrifice any Smalltalk functionality if I could avoid it, and I didn’t want to sacrifice any .NET functionality either.” That’s an admirable goal, and begs the question: What does S# offer that other .NET languages don’t?
Microsoft recognizes that scripting languages are an important part of a fully rounded language strategy. During Project 7 Lightening, Simmons said that Microsoft’s goals were “to make sure that we can put it into the next generation and that we aren’t doing something to lock ourselves in to exclude the possibility. So rather than actually try to solve some of those problems then, they began to focus on making sure that they weren’t simply providing solutions that were precluded [by the release version]. So I think that Microsoft has been pretty good about that, but there are many people who recognize that there are a lot of dynamic language features including Edit-and-Continue kind of stuff that they absolutely want to have, they don’t have them, and that makes them vulnerable to other languages or systems that can offer that on a competitive stance.”
That S# doesn’t require strongly-typed variables is only one of its advantages. Simmons says, “One of the things that S# does is that it enhances the Smalltalk language so that it allows you to write in a VB style so you can use the whole dot syntax and so forth, you can declare variables at will. It should be more familiar than classic Smalltalk.”
Beyond that, you can perform operations impossible in VB.NET or C#. For example, you can inherit sealed classes, such as System.String, and extend them to meet your needs. You can call external DLLs?not just ActiveX DLLs, or Win32 APIs, but any external DLL. You can dynamically add methods, properties, and fields to existing classes exposed by an assembly.
S# helps solve some relatively intractable problems. For example, you may declare a parameter of a public method as an object of type String. Within your method, you call the String.IndexOf method. So far so good?but you have to plan for errors. Another programmer is perfectly free to call your method and pass a Null (Nothing, in VB.NET). Despite the fact that Null is not a String, the .NET framework will happily make the call. That means that your method code needs to check for the possibility that someone did in fact pass a Null, and react accordingly. In contrast, in S#, Null is a true object, meaning you can simplify your code by dynamically adding a Null.IndexOf method, and doing nothing. At one fell swoop, you’ve eliminated both the possibility of an error and all the “if (var == null)”checks you have to write in other languages.
S# supports multiple inheritance. Now, the .NET framework doesn’t actually support multiple inheritance directly, so, like Eiffel (another language implemented on .NET that supports multiple inheritance), S# performs aggregation under the covers to simulate multiple inheritance capabilities.
Another big problem with typed languages surfaces with collection types. For example, Microsoft recently announced the addition of generics to C# (and possibly VB.NET) in the Whidbey release. .NET programmers are by now intimately familiar with the need to cast objects placed in a collection, such as ArrayList, back to the original type before being able to use the object efficiently. S# solves that problem by intrinsically being able to treat an object variable as the appropriate underlying type, eliminating all that casting code (and the need for generics).
S# creates assemblies that are fully .NET compatible, meaning you can use or inherit them from other .NET languages. If you debug into an S# class from, say, VB.NET, Visual Studio will step you directly into the S# code, and you can set breakpoints and add Watches just as with any other .NET language.
S#’s Target Audience
Simmons admitted that Smalltalk (and S#) are not mainstream, must-know languages, but said that he feels that the existing Smalltalk community is a sufficiently large target audience for this release. Current Smalltalk programmers and language hobbyists using other Smalltalk implementations eagerly anticipate using S# to take advantage of the .NET framework’s power, such as writing Web services, ASP.NET applications, Windows services, and console applications. But beyond that, Simmons anticipates an increasing audience of people who want the additional power of S# or who prefer to work in scripting-type languages.
SmallScript Corp. is a member of the Microsoft Visual Studio Integration Partner (VSIP) program, so S# will integrate directly into Visual Studio. Simmons said that a beta release of S# will be available for free download from the SmallScript.org (http://www.smallscript.org) Web site before the end of the month?most likely between the 18th and 24th of February. If you’re curious about S# or Smalltalk, this is your chance to be an early adopter of this venerable, yet curiously prescient language on the .NET platform.