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
|
Introduction:
Every language under the sun these days is Object Oriented. In an
effort to make POSIX shell more buzzword compliant, and to show
that it's really not a big deal for a language to lack built-in OO
support, we have added object orientation to plain old shell
script. Specifically, we have implemented classless OO with intro-
spection, finalization, serialization, and multiple inheritance.
Even then, most of these buzzword features are add-on modules.
Shoop scripts look similiar to some OO languages, but there are
various differences. Most of these differences stem from the fact
that the shell is the limiting factor.
Statements:
A valid shoop statement has the following form:
<obj> . <name> [ \.?[=:]q?p?) (<value>|<code>)]
Each item as the following definitions:
obj:
The name of the object.
variable:
A non-typed variable. This, in grand shell fashion, stores
its data as a string.
name:
The name of the method or variable in which to access.
value:
The text string that should be assigned to the variable or
method.
Assignments:
When the character immediately following the method/variable is
'=' or ':', an assignment takes place. If the character is '=',
the name refers to a variable, and the value is treated as a text
string. If the character is ':', then the name is a method.
There are 3 assignment modifiers that can be used. If the above
character is preceeded with '.', then this means to append the new
value to the current value. A 'q' on the end means to not echo
the results of the assignment('q' only makes sense when assigning
to a variable). If the 'p' modifier is used, then the method/
variable is invisible to introspection. All the distributed
modules use :p.
Methods:
Methods are short shell snippets, that process arguments, and
optionally return data.
code:
The program code that should be run. The shell variable $THIS
will contain the name of the current object, and the positional
parameters("$@", $*, etc) will contain the method arguments.
method:
A function or subroutine that optionally takes a list of argu-
ments.
See also:
modules.txt
|