I have added some new Lisp builtin functions to enable Smalltalk classes and messaging:
- class-of shows the class of an object
- new makes a new instance of a class
- add-method adds a method (lambda closure) to a class
- send sends a message to a class
These are some tests:
(class-of "hello world")
String
(class-of 123)
Number
(class-of Object)
Object class
(class-of (new Object))
Object
(add-method (class-of Object) 'test1 (lambda() "this is a class method")))
#<function :lambda () ("this is a class method")>
(add-method Object 'test1 (lambda() "this is an instance method")))
#<function :lambda () ("this is an instance method")>
(send Object 'test1)
"this is a class method"
(send (new Object) 'test1)
"this is an instance method"
(add-method Object 'times2 (lambda(x) (* x 2))))
#<function :lambda (x) ((* x 2))>
(setq abc (new Object))
a Object
(send abc 'times2 12345)
24690
The coming steps in implementing Smalltalk for Flash are:
- add Transcript panel to IDE
- add ClassBrowser to IDE
- build classes from startup file
- build Smalltalk reader (specialized Lisp reader)
- create Lisp macros to translate Smalltalk syntax
- change IDE to “virtual desktop” model
Once Smalltalk is running in Flash, I will begin the process of synchronizing classes between the .Net and Flash implementations. When that is done, you should be able to write Smalltalk applications that can run unchanged in almost any client environment: WPF (Vista, IE7), WPF/e (IE7, IE6, Firefox, Macintosh), Flash9 (IE7, IE6, Firefox, Opera, Safari, on Vista, XP, Win2003, Macintosh, Linux) or Adobe Apollo (desktop for Windows, Macintosh, Linux). And, they may even run in Samsung’s new iPhone competitor which apparently will use Flash.