The class creation syntax in Xbase++ is slightly different to that used with Class(y). Some of the differences are documented in the Xbase++ manual but for completeness I'll outline those, and other, differences.
The Class(y) syntax for starting a class definition is:
CREATE CLASS <class>
In Xbase++ it is simply:
CLASS <class>
Also, Class(y) allows you to inherit using either the keywords FROM or INHERIT, as in:
CREATE CLASS XbasePlusPlus FROM Clipper
CREATE CLASS XBasePlusPlus INHERIT Clipper
Xbase++ only allows for the FROM form of the syntax.
All of these differences are easily handled with the following pre-processor directives:
#xcommand CREATE CLASS <x> => CLASS <x>
#xcommand CREATE CLASS <x> FROM <y> => CLASS <x> FROM <y>
#xcommand CREATE CLASS <x> INHERIT <y> => CLASS <x> FROM <y>
[TODO: The METACLASS clause]
[TODO: The class function]
Xbase++ doesn't like to find a space in the End Class directive. This is easily solved with:
#xcommand END CLASS [<*x*>] => ENDCLASS
The syntax for having a "message" call a method of a different name is different in Xbase++. In Class(y) you would do:
MESSAGE Foo METHOD MyFoo
but in Xbase++ you do:
METHOD Foo IS MyFoo
Again, this can be solved with the use of the pre-processor:
#xcommand MESSAGE <x> METHOD <y> => METHOD <x> IS <y>
Xbase++ uses a slightly different syntax when declaring a deferred method. With Class(y) you would use:
MESSAGE Foo IS DEFERRED
in Xbase++ you use:
METHOD Foo IS DEFERRED
The pre-processor directive:
#xcommand MESSAGE <x> IS DEFERRED => METHOD <x> IS DEFERRED
solves this problem.
Class(y) allows a form of strong typing for instance variables, Xbase++ does not support this. A simple fix for this incompatibility is to use the pre-processor:
#xcommand VAR <x> [<ro:READONLY>] TYPE <y> => VAR <x> <ro>
#xcommand CLASS VAR <x> [<ro:READONLY>] TYPE <y> => CLASS VAR <x> <ro>
Class(y) provides the VISIBLE command to for symmetry with the HIDDEN command and it is little more than an alias for EXPORT. You can fix this with the pre-processor:
#xcommand VISIBLE: => EXPORT: