Fuzion Logo
flang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

Fuzion Features

In Fuzion, the main element to structure a program is a feature. A feature combines data and executable code into one single and powerful concept. A feature takes the role of a class, method, function, routine, field, interface, trait, package, module, procedure, variable, (formal) argument, member, etc. in other languages. We need to find a good term for this in fuzion. I will use feature for now, which is used in Eiffel. Alternative names might be atom, unit, part, item, detail, class, element, component, bit, piece, thing, entity, grain, cell, body, frame, form, section, sphere, entity, ensemble, act, actor, art, craft, skill, member, deed, feat, etc.

Features containing data

Regarding the data, a fuzion feature can be regarded as a concept similar to a struct in C/C++, or like a class in Java, but without the additional overhead that typically is required for a class. As an example, the Fuzion code
  point(int x, y) { }
Features are types and variables can be declared and initialized with a given feature type, e.g.,
  p := point(3,4);
This is similar to the declaration of a C struct
  struct point {
    int x, y;
  }
and the creation of a C variable of this type
  struct point p = { 3, 4 };
Regarding features as a container of data of different types, features provide product types.

Features containing code

A feature that contains code might look like this
  i32 add(i32 a, b)
  {
    result = a + b;
  }
which corresponds to a C function
  int add(int a, b)
  {
    return a + b;
  }

Features combining code and data

TBW