4 its meaning (informal)
\r
11 Program is a unit. It is the root of a tree of units.
\r
12 During an execution of the program this tree is
\r
13 used as a collection of patterns for instances. An
\r
14 instance of a unit is either an activation record (of
\r
15 a procedure) or an object(of a class).
\r
20 there are five forms of a declaration:
\r
24 var, const, unit, signal, handlers
\r
27 declaration of variables x of type T, y,z of type U
\r
29 unit A: B<kind>(params);
\r
33 last_will: <instructions>
\r
36 evidently you need not to inherit from a module
\r
37 declaration of a module A which inherits from B.
\r
38 kind may be one of: procedure, class, coroutine,
\r
39 process, block, handler, function
\r
40 params is a list of formal parameters,
\r
42 - block has no name
\r
43 its first line is: block or pref C block
\r
44 - function has a type of result after parameters,
\r
45 - handler has a different form., see below,
\r
46 - last_will instruction are executed exceptionally.
\r
49 declaration of a constant
\r
52 signal Alarm(x: T, y: Q);
\r
53 declaration of a signal S
\r
54 it may have a list of formal parameters
\r
58 when sig1,SIGN3: Inst; return;
\r
59 when sig2: instructions2; wind;
\r
60 others in; terminate
\r
62 declaration of a module handling exceptions,
\r
63 sig1, sig2, SIGN3 are names of exceptions,
\r
64 Inst, instructions2,in are sequences of instructions
\r
66 handlers appear as the last declaration in a unit
\r
71 Parametrisation of Units
\r
74 modes of transmission:
\r
75 input, output, inout values of expressions
\r
77 also procedure, function, type can be
\r
78 transmitted as a parameter
\r
79 formal procedures(functions) should be specified
\r
80 i.e. the types of arguments and results should be
\r
82 a formal type T alone is of limited use, however it
\r
83 may accompany other parameters using T.
\r
85 Processes are distributed it means that
\r
86 they cannot share objects. You can
\r
87 transmit only values of simple types and
\r
88 names of processes or formal procedures
\r
89 to be used for alien calls.
\r
90 Processes can reside on different systems of your
\r
91 network. This explains the reasons for the
\r
93 The present implementation of processes has
\r
94 several limitations. Sorry.
\r
103 assignment instruction
\r
105 x := copy (<expression>)
\r
106 copying assignment instruction, has sense only for
\r
109 call Aprocedure(params)
\r
110 procedure call instruction
\r
113 leaving procedure or function
\r
115 exit or exit exit or exit exit exit
\r
116 leaving one, two or three nested loops do od
\r
118 new Aclass(params)
\r
119 instruction generating an object
\r
124 x := new Aclass(params)
\r
125 creates an object of class Aclass with params
\r
126 and stores it under the name of x
\r
128 end Aclass or return
\r
129 terminating initialisation of a newly created object
\r
132 deallocation instruction, causes{x=none}and kills x
\r
133 REMARK. No dangling references!
\r
134 {x=y&x=z} => kill(x) {x=none&y=none&z=none}
\r
137 pseudoinstruction: a slot for the instructions of an
\r
143 x := new Cor(params)
\r
144 creates a coroutine object x of type Cor
\r
147 activates coroutine x, and then makes the current
\r
148 coroutine chain passive
\r
151 undoes the last attach
\r
153 Processes & Concurrency
\r
154 truly object oriented processes and an objective com-
\r
155 munication mechanism just by calling methods of a
\r
158 proces5:=new procesType(...);
\r
159 creates an object of
\r
160 unit procesType: process(<formParams>); ...
\r
163 activate a passive process process5
\r
166 the current process passivates
\r
168 enable hisprocedure
\r
169 adds the name hisprocedure to the MASK of the
\r
170 process, enabling other processes to communicate
\r
171 with the process by means of hisprocedure
\r
173 disable aProcedure,aFunction
\r
174 deletes aProcedure,aFunction from the MASK
\r
176 accept aProc1, aProc2, aFnctn
\r
177 process waits (inactively) for another process
\r
179 accept makes possible rendez-vous of this process
\r
180 and another process calling his method
\r
182 return disable aProc1 enable aQ
\r
183 return from a rendez-vous reestablishes the MASK
\r
184 of the called process; it is posible to modify its
\r
185 MASK disabling some procedures and enabling
\r
188 call proces5.hisprocedure(par)
\r
193 the current process demands process5 process to
\r
194 execute hisprocedure with the transmitted par
\r
195 parameters and waits for the eventual outputs;
\r
196 1 this instruction may meet with an accept
\r
197 instruction of process5 process - in such case there
\r
198 is a rendez-vous of two process,
\r
199 2 otherwise the call tents to interrupt the normal
\r
200 flow of execution of the called process5 process.
\r
207 Asignal is raised. This lances the research of a
\r
208 module handling the signal along the chain of DL
\r
209 links i.e. along dynamic fathers of instances.
\r
212 * returns to after raise statement
\r
215 * 3 forms of terminating an exception handling
\r
218 * destructs (lastwill) several instances of units
\r
221 Composed instructions
\r
224 if * then I else J fi
\r
225 * is a Boolean expression
\r
226 I, J are sequences of instructions {else J is optional}
\r
229 looping instruction; it is suggested to put an exit
\r
230 instruction among the instructions I, see below
\r
233 * is a Boolean expression
\r
234 I a sequence of instructions
\r
237 if * then I else exit fi
\r
240 for i:= A to B do I od
\r
241 i integer variable, A, B integer expressions,
\r
242 I a sequence of instructions
\r
249 I, J are sequences of instructions
\r
250 c is an expression, c1 is a constant
\r
257 Arithmetic expressions
\r
260 Boolean expressions
\r
261 remark in and is object relations, e.g. if x in Clas2
\r
266 new T(actual_params)
\r
267 create new object of class (coroutine, process) T
\r
268 passing the actual_params list to it
\r
271 returns as a value the object of type T containing
\r
275 qualifies the value of E as of type A
\r
276 Raises error if not E in A
\r
279 returns a copy of value of the object expression E
\r
281 Character expressions
\r
285 only constant strings!
\r
288 Inheritance & Nesting *
\r
290 2 fundamental methods of unit's composition
\r
292 Multi-level inheritance permits to make
\r
293 extensions of classes, coroutines,
\r
294 processes defined on different level of
\r
295 the nesting structure of units.
\r
296 Multi-kind inheritance permits to inherit in a
\r
297 block, procedure, function, class, coroutine or
\r
301 Multiple inheritance is doable by means
\r
302 of multi-level inheritance and other
\r
303 ingredients of Loglan.
\r
304 Generic modules are doable in various ways: by
\r
305 formal types, by multi-level inheritance combined
\r
306 with nesting, to say nothing about virtuals.
\r
309 Loglan'82 Quick Reference Card - 3 - December, 94
\r