Fixed allSelectorsSent because a simpler implementation was overriding the original.
[cslatevm.git] / doc / sysdesign.lyx
blob9538d9863bf9304e631d5d7f895026fb16bcd681
1 #LyX 1.3 created this file. For more info see http://www.lyx.org/
2 \lyxformat 221
3 \textclass article
4 \language english
5 \inputencoding auto
6 \fontscheme default
7 \graphics default
8 \paperfontsize default
9 \papersize Default
10 \paperpackage a4
11 \use_geometry 0
12 \use_amsmath 0
13 \use_natbib 0
14 \use_numerical_citations 0
15 \paperorientation portrait
16 \secnumdepth 3
17 \tocdepth 3
18 \paragraph_separation indent
19 \defskip medskip
20 \quotes_language english
21 \quotes_times 2
22 \papercolumns 1
23 \papersides 1
24 \paperpagestyle default
26 \layout Title
28 Slate System Design
29 \layout Author
31 Brian T.
32  Rice
33 \newline 
34 Lee Salzman
35 \layout Abstract
37 This paper outlines the plans for and documents Slate language and environment
38  design decisions, the motivations behind them, and open questions.
39 \layout Standard
42 \begin_inset LatexCommand \tableofcontents{}
44 \end_inset 
47 \layout Section
49 Introduction
50 \layout Standard
52 Slate is a 
53 \begin_inset Quotes eld
54 \end_inset 
56 clean slate
57 \begin_inset Quotes erd
58 \end_inset 
60  variant of the Smalltalk language and system idea.
61  The project was started in 2000 as a series of experiments to see what
62  could be made of the Self project results to benefit everyone.
63  Numerous models were tried and thrown out.
64  Finally, we decided to take a few principles and re-work the Smalltalk
65  language without bothering the syntax or mind-set involved unnecessarily.
66  The result was surprisingly usable and still afforded us a large enough
67  expansion on the original expressive power to justify building a new system
68  around it.
69  This paper presents the ideas involved in what resulted, and details some
70  plans for the design.
71 \layout Section
73 Semantics
74 \layout Subsection
76 Smalltalk Basis
77 \layout Standard
79 Slate is largely based on objects as sets of properties with methods defined
80  on them, which are dynamically activated by message-sends from other objects.
81  Pieces of code can be encapsulated and remotely activated as block objects.
82  Block objects in Slate have closure semantics: the scope which defines
83  the block of code is remembered by the block wherever it is passed.
84 \layout Subsection
86 Multi-method Dispatch
87 \layout Standard
89 Slate uses a method-lookup algorithm that cooperatively involves all arguments.
90  In order to be intuitive for those coming from a single-dispatch background,
91  method precedence is associative with the left-most arguments.
92  However, Slate does not yield privileged access to any single method argument
93  by default.
94 \layout Standard
96 Multiple dispatch is a complex process, so it involves a performance penalty.
97  Traditional implementations compile a table of methods with the same name,
98  and select a method from the table based on the message-send signature.
99  Slate's lookup system is lazier than this, by having each object remember
100  its 
101 \begin_inset Quotes eld
102 \end_inset 
104 roles
105 \begin_inset Quotes erd
106 \end_inset 
108  in methods, and traversing up the inheritance chains until a first-appropriate-
109 method is found.
110  This basic principle allows a simple dynamic system which only imposes
111  a significant penalty for multiple dispatchings when they are used.
112 \layout Standard
114 The benefits to be reaped basically amounts to clarity and a removal of
115  a level of indirection in the case where multiple dispatch is often emulated
116  in regular systems.
117  The common 
118 \begin_inset Quotes eld
119 \end_inset 
121 double dispatch
122 \begin_inset Quotes erd
123 \end_inset 
125  pattern has turned out to constitute the majority of multiple dispatch
126  cases, and some libraries are a lot more lucid once translated if they
127  heavily involve binary operators involving both types in the logic.
128 \layout Subsection
130 Prototypes
131 \layout Standard
133 Methods may be installed on any instance in the system, including immediate
134  objects (Integers, Characters, etc.).
135  So, handling Singleton objects in any argument position is more directly
136  expressed.
137  This is more significant when laying out an environment and customizing
138  the various objects within for tasks, without having to delineate distinct
139  classes for each functionality.
140 \layout Subsection
142 Methods as Named Closures
143 \layout Standard
145 Slate's methods are developed as an extension of the definition of code
146  blocks.
147  A method's signature is followed by a block definition.
148  The argument names in the signature become block arguments, and the dispatched
149  arguments' roles are annotated to include this closure.
150  This allows method definition to be 
151 \begin_inset Quotes eld
152 \end_inset 
154 free-standing
155 \begin_inset Quotes erd
156 \end_inset 
158  in comparison to the characteristic of Smalltalk-80 systems to use a very
159  specialized method definition syntax which suits the browser tool, and
160  has a place within the chunk format, but generally doesn't have any fundamental
161  ties to the language or system.
162 \layout Subsection
164 Subjective Dispatch
165 \layout Standard
167 An idea only briefly visited some years ago by David Ungar and Randall Smith
168  is the idea of subject-orientation: treating the context as an extra invisible
169  argument to a message.
170  We are looking at seeing what is possible in this area, with structured
171  notions of context, perhaps to represent the current user, some system
172  state, or access level.
173 \layout Standard
175 The current plan is to implement this as an extra-argument part of the multiple
176  dispatch as an experiment in this functionality.
177 \layout Section
179 Syntax
180 \layout Subsection
182 Smalltalk Basis
183 \layout Subsection
185 Self Influence
186 \layout Standard
188 Slate inherits Self's lack of direct slot assignment syntax, requiring normal
189  access and update to occur through methods.
190  There is a reflective interface which overrides this, and the accessor/mutator
191  methods work with this level.
192 \layout Standard
194 Also like Self, any references to identifiers are really message-sends to
195  the local context.
196 \layout Standard
198 It is worth noting that Self's 
199 \emph on 
200 object literal
201 \emph default 
202  syntax is not used in Slate; block definitions mostly suffice, and methods
203  cannot be inserted into object slots, so the need does not arise.
204 \layout Standard
206 A small change was adopted for the same reasons that Self used it.
207  Block headers must be delimited on both sides by vertical bars, to help
208  distinguish the local declarations from implicit context sends.
209 \layout Subsection
211 Removal of Bang
212 \layout Standard
214 Slate has generally taken the route of a declarative build from independent
215  source files until we achieve some bootstrapped system status.
216  This has allowed the presentation of Slate without a purpose-built development
217  environment in order to rapidly evaluate the ideas without the subtle influence
218  of others.
219  Thus far, the need for a 
220 \begin_inset Quotes eld
221 \end_inset 
223 chunk
224 \begin_inset Quotes erd
225 \end_inset 
227  format has not arisen, so the bang signifier in chunk-style inputs has
228  not been allocated from the character table.
229 \layout Subsection
231 Method Definitions
232 \layout Standard
234 Method definitions consist of a method signature denoted with the 
235 \family typewriter 
237 \family default 
238  character between the argument name and a dispatch expression.
239  The parser expects some object to follow which yields a block which constitutes
240  the method's body.
241 \layout Subsection
243 Separator Sensitivity
244 \layout Standard
246 Slate currently follows a liberal policy about identifiers, which makes
247  whitespace as a separator very important.
248 \layout Subsection
250 Character-Appropriation Summary
251 \layout Section
253 Core Libraries
254 \layout Subsection
256 Strongtalk-Influenced Collections
257 \layout Subsection
259 Conditions
260 \layout Standard
262 The exception-handling system is based on Dylan's condition system, itself
263  an object-oriented version of Common Lisp's condition system.
264 \layout Section
266 Environment
267 \layout Subsection
269 Namespaces
270 \layout Subsection
272 Packages
273 \layout Subsection
275 Threads
276 \layout Section
278 Run-time
279 \layout Subsection
281 Image
282 \layout Subsection
284 Intermediate Language Encoding
285 \layout Subsection
287 Type Engine
288 \layout Section
290 Conclusion
291 \the_end