Skip to content

eigood/shoop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What on earth is this?

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.  (Next up: awk) Specifically,
we have implemented classless OO with introspection, finalization, seriali-
zation, and multiple inheritance.

Shoop will work in any POSIX shell.  It requires no third-party UNIX tools
at all.  We do reccommend you do not run it under bash, since bash is very
slow at recursion.  Use ash: it's significantly faster.  To see just how
fast, run "make benchmark".

When you source shoop.sh, you start out with a single base object, OBJECT.
You can make a new object named OBJ that has OBJECT as its parent like so:

OBJECT . new OBJ

You can add/change a property of OBJ like this:

OBJ . property = 3

You can add/change a method of OBJ like this:

OBJ . method : echo "hello world!"

You can call a method or get the value of a property like this:

OBJ . property
OBJ . method

Both will output the value of the property or return value of the method to
stdout.

You can change the parent of an object like this.  Specify multiple parents
and multiple inheritance starts happening:

OBJ . parent = FOO
OBJ . parent = BAR BAZ QUUX

You can call an overridden method like this (used inside the method that
overrode it, generally):

THIS . super method

If you want introspection, finalization, or serialization, or various other
features, see MODULES.  If you have a module you think would be benefitial
to the shoop community, see CONTRIBUTING.  If you've written something
interesting that actually _uses_ shoop, the authors would love to hear about
it.

That's about it.  Now run off and write a MOO or something.

Shoop is copyright 2000 under the terms of the GNU LGPL by this pack of
maniacs:
	Joey Hess <[email protected]>
	Adam Heath <[email protected]>

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published