Skip to content
Justin Szaday edited this page Jul 5, 2021 · 2 revisions

All Kinds of Types

Ergoline has three kinds of concrete (instantiable) types, those being:

  1. Structs — Classes whose instances are passed by value (by default).
  2. Classes — Classes whose instances are passed by reference (by default).
  3. Objects — Classes with a singleton instance (one-per-PE).

Furthermore, it has two kinds of abstract types:

  1. Traits — May have abstract or concrete methods but cannot have fields. Classes may implement from multiple traits.
  2. Abstract Classes — Does not impose restrictions on members, but classes may only extend one abstract class.

All these types are specializable and can be made generic.

Note, certain types (currently) exist in "gray areas" and receive additional language support, those being:

  • Tuples — Effectively generic structs with designated syntax.
  • Lambdas — Effectively generic classes with designated syntax.
  • Proxies — Effectively generic structs with auto-generated methods and designated syntax.

Looking forward, we strive to make these language features more generic, and enable user-types to utilize them as well.

Native Types

Users may generate wrappers for C/C++ structs/classes into Ergoline as native types via the @system annotation (see libs/ergoline for examples).

On Variables and Function Parameters

All variables of reference types are smart pointers to heap-allocated memory; users need not be concerned with memory management. Arguments passed between non-entry methods are passed by modifiable reference; Ergoline has no notion of "const". Arguments of entry methods always have copy semantics. Threads may only communicate with other threads via entry methods or atomic variables, precluding data races.

On Pupp'ing

Ergoline automatically generates pup methods for its object-types, pup'ing all contained fields (and calling the pup'pers of parent classes). This behavior may not always be desired, so users are encouraged to use the @transient annotation to exclude fields from auto-pup'ing or, with discretion, manually specify their own pup functions.

Clone this wiki locally