Hello World!

December 7, 2010

Silver Smalltalk

Silver Smalltalk

http://silversmalltalk.appspot.com/

“Silver Smalltalk” is an implementation of Smalltalk-80 for Microsoft’s Silverlight platform.

Above is a link to a deployment of the latest version. The XAP (Silverlight binary) file is 159 kb in size and should run in any Web browser with the Silverlight 3 (or higher). I have successfully tested it in Safari, Chrome, Firefox, Opera and IE 8.

Silver Smalltalk uses a bytecode interpreter modeled after the Squeak Smalltalk VM; the syntax also follows Squeak syntax.

Here are a few new concepts in SST:

  • every object has a type as well as a class
    123 class ==> Integer
    123 type ==> System.Int32
    123 class class type ==> Smalltalk.VMetaClass
  • objects can receive Smalltalk messages or “native” messages
    ‘hello’ + ‘world’ ==> ‘helloworld’ (Smalltalk “+” message)
    ‘hello’ @ToUpper ==> ‘ HELLO’ (native .Net call)
    (‘hello’ + ‘world’) @ToUpper ==> HELLOWORLD (combined)
  • .Net classes can be “mapped” to Smalltalk classes
    Int32 is “mapped” to the Smalltalk Integer class
    123 class ==> Integer
    123 class superclass ==> Number
  • .Net classes can be extended with Smalltalk methods
    123 squared ==>  15129 (System.Int32 extended with “squared” method)
    ‘—{0}—-{1}—‘ format: ‘hello’ with: ‘world’ ==>  ‘—hello—-world—‘
    (System.String extended with “format:with:” method)

A tiny code snippet used for the image above:

1 to: 5 do:[:i | Transcript println: ('{0} Hello World' format: i)]

Silver Smalltalk is designed to join the simplicity (and fun) of programming in Smalltalk to the powerful capabilities of Microsoft Silverlight – animations, vector graphics, widgets, multi-threading, videos, etc.

And the applications should be deployable on any .Net WPF (Windows Presentation Foundation) platform including Windows Vista, Windows 7 (Desktop), Silverlight browser plugins, or Windows 7 phone.

Advertisements

2 Responses to “Hello World!”

  1. Chip Nowacek Says:

    How dramatically will the differentiation between ‘native’ and ‘smalltalk’ message syntax impact portability? I assume having the differentiation allows for a ‘pass-through’-like library access. Would it make sense for me to wrap the native stuff so I only have native message syntax in one place?

  2. Peter Fisk Says:

    For portability, it is good to separate the primitives from the higher-level Smalltalk functions.

    I will be discussing this in much more detail when some of the Adobe AIR libraries are posted.

    — Peter


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: