Menu

Tree [6b34a7] master /
 History

HTTPS access


File Date Author Commit
 demos 2021-03-03 canewbould canewbould [6b34a7] For OE4 usage
 docs 2020-09-29 CANewbould CANewbould [048bdb] Updated document files
 euphoria311 2020-09-29 CANewbould CANewbould [7648a5] Removed error file
 euphoria4 2021-01-06 canewbould canewbould [c5c381] Euphoria4 libraries
 include 2020-09-29 CANewbould CANewbould [5d9d5c] revised library modules
 readme.md 2020-09-30 CANewbould CANewbould [945fea] Updated version

Read Me

EuCANOOP

Eu[phoria] CAN [do] OOP, as presented by C A N[ewbould]!

This repository contains a basic set of OOP libraries, being an extension to all forms of Euphoria, along with a set of examples which illustrate how the libraries can be used in practice.

The core library, eucanoop.e, provides the essential nuts and bolts of the development. Classes are defined using the Class procedure. They can be abstract or inherit from one or more pre-defined Classes. The Property procedure along with the Method procedure enable the Class to be detailed. Classes, Properties and Methods are all identified using textual strings.

Objects are created using the Instance function; each is identified using a variable name. Every Object has two built-in Methods: getv and setv, as accessor and mutator, respectively, as well as those defined within the specific Class definition. Methods are called using either func or proc, depending on the existence, or not, of a return value.

Classes and Objects are handled internally using a sequence-based storage system, similar to the map approach found in Open Euphoria.

The Core library also contains a number of inspection routines, which can be very useful for testing purposes.

Further details of each library can be found in the relevant file in the docs folder. The documentation is produced by extracting selected comment from the source code, so reading the code file itself is an alternative way of obtaining the relevant detail.

Modifications and simplifications

Because Open Euphoria offers a number of additional facilities, it is possible to generate a simpler OOP model from the same principles used here. This alternative is located in the euphoria4 folder, which also contains all the library modules and demo examples modified to fit this approach.

The differences are ones of simplification:

  • The function Instance can be replaced by the more conventional New
  • func has a method alias, as the OE4 model encourages the use only of
    functions
  • a default naming convention (class-name_method-name) can greatly simplify the definition of Methods
  • there is no need to specify a parent in a base-class definition

A future branch, as yet unnamed, will offer a (pre-processor) syntax which, using ::, allows a dot-style notation to be adopted.

Contributions

Anyone wishing to make suggestions or provide examples of using EuCANOOP should contact the owner of the repository. All ideas are welcome.