Notes
Outline
The SmallScript™      Language
and Platforms
Introduction and Overview to the
QKS® Smalltalk-2000 dialect
and its support of the
Microsoft® .NET Platform
Background and Bits of History
David Simmons
Smalltalk Heritage
Quasar Knowledge Systems, Inc. “QKS”
Founded 1989…
Agents Object System™ “AOS® Platform”
Object Repository and Multi-language Object System Platform/Backplane for Servers and Distributing “Agents” objects
QKS Smalltalk “SmalltalkAgents® for Mac”
Multimedia, graphics, MacOS extended features emphasis
QKS activities and focus with Apple Corporate meant we failed to properly address the real market changes, needs and opportunities
SmallScript – 1998 Origins and Objectives
 Slide A
Develop new language as a superset of QKS Smalltalk which would fit the “popular” language development paradigms and retain the ability to build systems like today’s rich Smalltalk IDE’s.
Enable Text based development w/XML source form
Transparent/linkable cross-language inter-op
Optional Typing System Unified with Smalltalk Classes, Interfaces / mixins, Extensible Fast Type Marshalling, and Multi-methods
Small injectable footprint for fast lightweight “in-proc” execution based on a new streamlined generation of QKS’ AOS Platform Technology
Enhance Functionality and Attractiveness for Scripting
Enhance with declarative grammar and syntax “sugar” extensions
Interface mixin behavior and COM/CORBA-like services for free
Provide flexible annotation system for extensions
SmallScript – 1998 Origins and Objectives
Slide B – more specific details
Natural design for components as well as use for integration of into existing application designs and application shells. Including but not limited to the Explorer Namespace System, Internet Explorer and Netscape, Visual Studio’s Shell, Linux KDE and/or Gnome, …
Small Projects ŕ Small Source Size ŕ Small DLL/EXE/Package
Fast Startup/Shutdown InjectedDLL/EXE Load in Milliseconds with no image required
Hi-performance Adaptive JIT Execution and FFI Marshalling supporting x-platform ports
Easy transparent/automatic access to external functions, COM/CORBA functionality
Automatic (no effort) support for exporting a Smalltalk class/interface as a COM/CORBA/C++ item.
Modular package and loading system to build components and applications by composition rather than traditional Smalltalk IDE system of decomposition. Build on QKS Agent Packaging and Distribution Technology
No compromise on Smalltalk’s Reflective EE Model and Meta-object Services. Utilize Language Independent Architecture of QKS’ AOS VM’s Object (Model) System
Scalable GC supporting incremental collection, pinning, C++ transparency, resizeable objects/structural morphing, extensible object layouts, managed code integration with JIT, finalization, arbitrary roots, efficient swizzling, static objects
Event: Summer 1999…
Microsoft COM+ 2.0
Microsoft contacts QKS to discuss something
named COM+ 2.0. Known today as MS.NET
What was it and how was it relevant to QKS?
Cross-language VM
VC++, VB, JScript, Cool (C#), … (no comment on Java)
Multiple CPU and OS Targets including embedded devices
Standard “Common” Object Model
Rich package-loader and metadata system
Security model
Replace COM of today and provide Internet and MS Web Services distributed infrastructure based on XML/SOAP
Demo: Visual Studio.NET based Smalltalk
A Cross Language Demo
C# inter-operates with Smalltalk under a common language model and VM
A DLL/EXE packaging architecture with rich metadata and security validation
Cross-language source level debugging
Integrated into Visual Studio.NET
Microsoft’s upcoming Web Services Design and Development Center
SmallScript and its relationship to .NET
Architecture (slide A)
SmallScript Runtime Platform Targets
What are the VM’s that support SmallScript?
QKS’ AOS Platform
“Agents Object System”
Microsoft’s .NET Platform
Sun Microsystems’ JVM?
CPU’s and Operating Systems by Platform
Runtime targets (and possible future runtime/platform targets)
AOS Platform
(Visual C++, Intel C++, GCC) – probably integrated
X86
Win32, (Linux, FreeBSD, BeOS – under development)
Possibly PPC (prelimary prep done)
Mac OS-X, Linux
Interesting Others (incl embedded)
WinCE (various)
Sony Playstation (MIPS)
PalmOS
Solaris
.NET Platform
X86
Win32
Other (probably in future)
WinCE (various)
Embedded Devices
No Word From MS
Linux
Macintosh
PalmOS
Solaris
…
Features of QKS’ Streamlined AOS v4 Platform
AOS Common Object Model & Services
Unified Object Model
No image file required
Headless w/ minimal OS/CPU dependence deployable as DLL
Extensible layered JIT and Compiler system (not STS specific)
Multimethods, first class dynamic type and interface mixin system
Rich meta-object services including read, write, bind delegation and managed objects
Pluggable architecture for VM extension via C++ and/or AOS methods and functions
Intrinsic XML parser. Modular package loader, linker, export system
Intrinsic Image / Class Library…
I18N/NLS Text Services
Numerics Processing System
Full featured compiler and reflection services …
Multi-threaded execution engine supporting headless servers and embedding
Hi performance FFI and namespace scoped multi-method dispatch, auto-vtables/COM, Selector Aliasing, …
AOS: A Unified Object Model
(slide 1 of 2)
All objects are logically viewed as having
Extensible set of properties
Resizeable number of (by-ref) Named slots
Resizeable number of (by-ref) Indexed slots
Resizeable amount of byte-storage w/(by-value) typed structure variables
Resizeable number of (by-value) Unicode Character elements
Class system built on top of Instance specific behavior system
Byte storage can be of any form including C++ objects, native heap, virtual, etc. It can also be indirected. Logically it is just a structured memory access.
Objects are fully resizeable and restructureable and the VM is optimized for heavy use of this feature to efficiently manage collections and streams
Weak references, initialization, finalization and full external lifecycle management are intrinsically supported
AOS: A Unified Object Model
(slide 2 of 2)
A Look at QKS’ v3 to v4 AOS Platform’s
Bootstrapped System
10000 factorial
Changing the main entry point startup sequence
Changing the compiler’s command line processor
How is the v4 system being created/bootstrapped
SmalltalkAgents v3 is temporary host for building v4
Used v3 Toolset and repository for auto-generating many parts of the v4 virtual machine
Repository and VM Integrated DB
Built core system classes and methods
Generates v4 C++ Object Model Sources
Look at C++ method declarations
NAKED Object[#basicBehavior]
Emit v4 fast load modules with v3 stack based opcodes
v4 extensible JIT system provides a v3 to v4 opcode compiler
v4 opcodes are virtual register based with load/store services designed specifically for optimal jitting functionality
SmallScript and its relationship with AOS
Architecture (slide B)
SmallScript Source Compilation
XML Compiler
XML Parse Tree (from XML Blob)
AOS Object Model: Dynamic Class and Type System (Used by SmallScript)
SmallScript Methods (other languages possible w/ appropriate compiler module)
SmallScript Method/Function Compiler(s)
SmallScript Parse Tree (from method source)
AOS Platform Opcode Set & Object Model
JIT to x86
JIT to .NET
JIT to Textual Dissassembler
Temporary: JIT from AOS v3 stack model to AOS v4 register model
Microsoft .NET Platform IL & Object Model
w/QKS Dynamic Language RTL Extension
Demo: SmallScript Subclassed by C#
A milestone for Smalltalk and Cross-language Technology
A Cross Language Subclassing Demo
C# subclasses (extends) a SmallScript class
C# directly reads and writes STS classes slots
ILDAsm used to look at DLL produced by STS compiler
Reflection and QKS Dynamic Language Work enables Smalltalk to extend the behavior of sealed .NET classes
Could have been done or could be further refined by
Visual Basic, C++, COBOL, etc.
SmallScript Language Objectives
(Quick Review)
Define a new language to unify QKS Smalltalk features and extensions developed over the years
Add syntactic sugar for familiar procedural and functional programming constructs
Provide Formal language support for namespaces, packaging/distribution and declaring design intent
Extend Smalltalk to be the richest adaptive language supporting a familiar and very linguistically competitive feature set
Provide dynamic behavioral type and dispatch system and related compositional benefits of interface mixin
Enable development of fast, small software elements
Enable transparent integration of Smalltalk with other languages
SmallScript is a Work in Progress
When will you be able to try the tools you’ve seen today?
When will the v4 system be fully bootstrapped (weaned/separated) from the v3 system?
Time Check…
What’s different about the SmallScript language compared to Smalltalk as we’ve known it over the years?
Use of XML As The Source Code Form
Designed For Describing The Object Model
The XML syntax used is designed not to be exclusive to SmallScript
It can be extended for other language compilers
It represents the declarative essence of the AOS Object Model
Method declarations can be in any language
Source within method bodies is distinct from the XML
Currently supports SmallScript and C++
Scheme is being explored
XML Entity and PD Forms
<assembly >
<module>
<interface>
<class>
<using/>
<include/>
<remove/>
<?SmallScript …?>
<?function … [ … ]?>
<?method … [ … ]?>
<?class-method … [ … ]?>
<?eval … [ … ]?>
XML Entity Attributes
name
version
id
mcid
inst-vars
/ by-ref-fields
class-vars
/ by-ref-class-fields
shared-vars
struct-vars
/ by-value-fields
implements
extends
imports
namespace / scope
module
dll / extern-lib
authors
lang
…
Assemblies, Modules
An assembly is a project/solution
Results in something like an InstallShield Package
Supports versioning and other elements to support the challenges of software deployment today
A module is an atomic unit of packaging for deployment and is thus a unit of ownership
Can result in discrete shared libraries (DLL’s)
May also be aggregated with other modules by an assembly to create a single executable/shared-library.
AOS Object Model
Dynamic Binding Process
Selector (namespace) Scope
Implicit scopes
Class and DLL/SharedLibrary Functions
Private behavior
Receiver behavior
Including Mixins of Implemented Interfaces
Argument types (multi-methods)
Return type
SmallScript Language
Interfaces & FFI Callback Marshalling
Behavioral Type System
Multi-methods
Transparent FFI
Transparent COM (and C++ vftable) behavior and integration
Mixin Behavior (Interfaces)
Multiple Inheritance
Namespace Scoped Binding
SmallScript Functions (not just methods)
Method or Function callout or callback support for automatic or custom argument marshalling
JIT inlines “thisContext” messages for fast custom marshalling raw data args via <type> system.
The custom marshalling form:
[…marshall…] onCallback.
Return values are marshalled automatically (as appropriate)
SmallScript Language
Variables – Shared Pool Variables
Types of Shared (namespace/pool) Variables
Standard Variable (think Association)
One shot initialization sets read-only property for primary variables like classes, functions, etc.
Imported Variables via Aliasing Indirection
Thread Local Variables
User extensible – variable types can leverage bind and access notification services
Why not just use Associations?
Support module system for fast load/link/unload
Intrinsic support for refactoring given modules
SmallScript Language
New Message Selector Forms
Apply-Value Message
(…)
anExpr() “alt-selector ŕ anExpr value”
anExpr(a) “alt-selector ŕ anExpr value: a”
anExpr(a,b)
Array-Slice Message
[…] or […:…] or […](…) or […]()
foo[x] := y.
aString[a:b] := c.
Array-Property Message
{…} or {…,…} or {…}(…) or {…}()
SmallScript Language
Some of the New Operator Expressions
Annotation Op
<…>
Reg Expr Op
#`…'
Environment Variable Op
#$ciname
Fn/Mth and Signature Op
#::…
Path Expr Op
#{…}
Binary Assignment Op
:binarySelector=
Styled String (incl XML)
`…'
Wide Strings via
L`…' W`…' L '…' W'…'
Array/slice Op
[…]
Property Op
{…}
Apply/Value/Function Op
(…)
Dot Path Expressions
A.B.C (or) {A.B.guid}
Reserved Op
#[…]
EOL Comment
""
Nested Comment
"*…*"
String and Comment Escapes
`n `r `[…`] `x…
`< xml/html >, etc.
SmallScript Language
Annotations
Branch Label
<:label:>
Metadata Tag
<'…'>
Alternate Selector
<::selector>
Processing Directive
<$dir…>
$scope, $interface,
$final,
$sealed,
$vftable=,
$routing-method,
…
Position Independent Named Arguments
<%keyword-arg-name%>
Type Annotation
<ref/in/out {…}.name | …> <name><any>
Semi-colon delimited ;
Equivalent Forms of Annotation Declarations
<…><…>
<…; …>
SmallScript Language
Keyword Expressions
for loop expressions
for (each <type> var in e)
for (setup. loop cond. update)
if, unless, else expressions
assert:level (expr) else (expr)
per-thread or vm jit exec control
while, until loop expressions
? : expressions
switch () […]
Cases can be combined
[case foo: … case bar: … break.]
try […] …
catch {a,[block-filter],value} […], fault/ifCurtailed, finally
Control Flow
<:label:> annotation
continue
break, break <:label:>, break (ret-expr), break <:label:>(ret-expr). Alternately use “leave”
goto
redo
Return forms (from, to home)
^, return, ^^, leave
Tail call annotation
Default is up to platform
Explicitly one can declare
tail:return expr/tail:^
notail:return /notail:^
SmallScript Language
Literal Forms
Characters
Numbers
Float, ScaledDecimal, Multi-precision LargeIntegers
Strings & StyledStrings
Implicit concatenation to add flexibility for string declarations
'…' '…'
Array’s
Selectors
Namespace Scoped Symbols
Additional message and functional forms
Signatures
Message Selectors with Type Descriptors
##Const
Regular Expressions
Environment Variables
Path Expressions
SmallScript Language
Intrinsic Variables
self / this
super
nil
false / no / off
true / yes / on
thread
thisContext
thisMethod
canvas
Convenience forms for skipping “routing” and “dispatching” methods
sender
senderMethod
senderContext
SmallScript Language
Expression Examples
<in/out> value-holder arguments and variables
Return types
Scoping
Variable declarations
Functions
Operators
Keyword Expressions
Questions & Answers
(if time permits or we can talk at the restauraunt?)