Library EuCANOOP

This repository currently contains the minimum requirement for writing a form of OOP programs using Open Euphoria (version 4.0.5 or later).

What is this repository for?

Using standard elements of the Euphoria Programming Language to simulate OOP.

To encourage users to develop additional libraries (standard or specialised) to contribute to this site, so that the library can stop being just for fun and become a tool for development. The long-term hope is that this set of libraries will become so extensive that it will be possible to write whole applications totally without recourse to standard (non-OOP) resources.

How do I get set up?

Ensure you have an up-to-date version of Euphoria (see above).

Place the libraries in the "includes/oop" folder in a visible place.

If necessary create an eu.cfg file in your programming folder.

Include, in each of your programs, a reference to the EuCANOOP routines, possibly with a public prefix. This can be done either through including EuCANOOP.e directly, or indirectly if using one of the libraries in the distribution or one of your own, by including that library file instead.

Read the Wiki to obtain the detail of the library's contents.

Look at the contents of the additional files and folders (as they appear) to get examples of both libraries (including a test program in every case) and illustrative applications.

Notes on use

Programming in EuCANOOP should present no difficulties for the experienced Euphoria user. All management, assignment and flow control activities are exactly the same. The main differences are:

instead of declaring objects, as variables, possibly of different types, in EuCANOOP only instances need be declared. As these are merely pointers they are best declared as constants. Typing and type-checking take place only when an instance's Property is assigned (at the point of declaration) or changed (using the mutator method set)

In EuCANOOP the type of a method is explicitly defined. In Euphoria a routine's type (function or procedure) is only clear in the context of use; whereas in EuCANOOP method-functions are called using func, method-procedures using proc.

In Euphoria a routine is invoked as follows: <routine_name>([<principal_object>,] [argument[s]]); in EuCANOOP the corresponding syntax is: <func|proc>(<principal_object>, <method_name, as string>, {[argument[s]]})

It is important to note that in a number of Euphoria libraries (both .e[w] and .dll) creator-functions are used to assign (ideally to constants) pointers/handles to objects. Wherever possible in EuCANOOP the corresponding constructor function uses the same name and the same arguments. This consistency also applies where the C function is turned into a Euphoria procedure: for example, from the Iup GUI library, the procedure IupMesage(string title, string message) does precisely the same thing in both the Euphoria library (iup4eu) and the EuCANOOP one.