These are the proposed features of the voodoo language
Introduction
The essential part of voodoo is an object. All objects inherit from the type object. About here it is idea to have a look at the builtin class heirarchy tree.
- type:-
-
- class
- method
- object:-
-
- integer
- decimal
- boolean
- string
If you have a variable of type object then it can ‘hold’ every type of object in the whole language. While those of you who use Java and other well designed OOP langauges will not find this new, it is a step in a new direction compared to C++.
If you have a variable of type type then it can hold all types in the whole language.
You can use the class type to store a reference to a class. This means it is possible do this:
class c = integer object i = c.alloc().init()
You don’t need to know what type of class you are creating, just that it is a class. I should introduce you to how I am envisioning object construction / deletion. A call to integer.alloc() will return a new integer. A call on this integer integer.alloc().init() will initialise the variable if it needs it. There is no such thing as a constructor in this language, but the designated way to pass arguments to a class is with an init method. The first init method takes no parameters, it is there for subclasses to rely on. One can create an initCopy(integer i) method if wanting to make a copy constructor. I am not planning on having the ability to overload methods (having more than one with the same name but different arguments) because I feel that what is gained by this functionality does not equal what is lost. Overloading in my mind creates a lot of ambiguity, you have lees of an idea what code is being executed. Update (2004.11.02) Then again overloading needs to happen with the build-in methods and it would seriously screw up the rest of the system if nothing else could.
All objects have a ’super’ and a ‘parent’ (except object). A super is the object’s class, but you can call and define methods for it. for example integer.alloc() is actually a call to the super class integer. When you have integer i = integer.alloc().init(); the object in i is now an instance of integer. The super class object integer is always present, all classes that are defined are present as this super class.