-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathlambda-moo-background-non-html5.html
77 lines (76 loc) · 4.75 KB
/
lambda-moo-background-non-html5.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<html>
<head><title>Lamba MOO Programming Tutorial--Background</title></head>
<body>
<h1>The source code for this file was taken from <a href="http://lions.cs.ndsu.nodak.edu/~vender/LambdaMOO/background.html">http://lions.cs.ndsu.nodak.edu/~vender/LambdaMOO/background.html</a> and is included in this repository for posterity. It is not HTML5.</h1>
<h1>Background</h1>
<h2>Environment</h1>
<P>C++ is a programming language. There is no seperate operating system,
or user environment associated with C++. For LambdaMOO, like Java, there
is a blurring of the distinction. LambdaMOO refers to the system running
(in this case) on a UNIX machine, using an interpreted language normally referred
to as either "The LambdaMOO programming language" or LambdaMOO. Is very
much like the problem of discussing Java the language, Java the virtual
machine, or Java the operating environment.</P>
<P>For the curious, I myself have no idea what the internal representation
of the code for the LambdaMOO system is. All I prove from my current knowledge
is that there are functions built into the system for changing the code
used in verbs, and for changing every attribute of objects in the
system, including changing the inheritence tree.</P>
<h2>Classes and Objects</h2>
<P>In C++, the difference between a class and an object is a concrete one.
Objects are instances of classes, and in general one manipulates objects.
In the LambaMOO system, there is very little (if any) distinction between
a class and an object. It is possible to create an object which inherits
from another object, add properties and verbs to that object, and then create
other objects which inherit from that newly created object. Essentially,
LambdaMOO allows for the dynamic creation and changing of classes, rendering
them indistinguishable from objects.
<h2>Functions and Verbs</h2>
<P>In C++, an object is said to have member functions. In LambdaMOO, an object
is said to have verbs. As a side effect of the interactive nature of
LambdaMOO, verbs can be invoked either by the built-in parser, or by
other verbs. LambdaMOO's interpreter does have certain functions, which
can be called inside of verbs, but these functions have been compiled
directly into the interpreter.</P>
<h2>new and delete</h2>
<P>C++ uses the new and delete operators for dynamically creating objects
during program execution. The equivalents for LambdaMOO are the built-in
functions create() and delete().</P>
<h2>Types</h2>
<P>C++ has static type checking. With the partial exception of virtual functions
(since the compiler still checks that the variables can be converted), all variable
variables and members are constrained in type at compile time. LambdaMOO, as
an interpreted system, does run time type checking. As such, it also has
provisions for checking the type of a variable.</P>
<h2>Using variables</h2>
In C++, a variable cannot be declared after it is used. Or rather, in C++
a variable in scope before it is used, either declared inside a function,
as a member of a class, or otherwise in scope to be used. For LambdaMOO,
variables aren't declared. Variables which haven't been assigned to essentially
have no type, and as such any attempt (other than assignment) will result in
the expression evaluating to an error (variable type ERR).</P>
In C++, global variables are simply variables declared outside of all other
scopes. In LambdaMOO, the properties of the System Object (Object #0) are
the closest thing to truly global variables, and special access rights are
required to create or change those values.
<h3>Variable Scope</h3>
<P>In C++, variables have lexical scope, meaning it is possible to use
variables which have not been declared inside a function, but which an expression
can "see". By the scoping rules of C++, it is possible to use the same
notation, or lack thereof, to refer to a variable which is local to function,
a class data member, or a global variable, a named contant, et al.</P>
<P>For LambaMOO, the scoping rules are much simpler. Or rather, the notation
is much more distinct. $GlobalVariable is a global variable named
GlobalVariable. this:MemberVariable is a member variable of the object
'this', and OtherVariable is a local variable named OtherVariable.
Member variables follow the reasonable approach to maintaining their
values, namely that the values of properties inherited from other objects
becomes distinct upon creating the derived object.
<P>
If you have experienced a language like Smalltalk, LambdaMOO doesn't seem much
like an object oriented system. In LambdaMOO, you have objects, and then you
have primitive types. Objects persist, everything else either gets stored on
an object or else eventually gets garbage collected into oblivion.
Aside from this issue, LambdaMOO is just as object oriented as C++, or Java.
</body>
</html>