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

Fuzion Declaration Syntax

Declarations for features may require type information if the type cannot be derived automatically by the compiler. The basic distinction here is whether the type should be before or after the declared feature.

Mixing type and declared entity

The C/C++ programming language chose to mix the types and the declared entity, e.g.,
  int a[3];
  int (*f)(int);
Such confusing syntax must be avoided, this is extremely hard to parse for humans.

Type before declared entity

This is used by Java (with exceptions):
  int[] a;
  java.util.Vector v;

Type after declared entity

  let y: f32 = 3.0; // f32
    x,y   : INTEGER;
x int
p *int
a [3]int
f func(func(int,int) int, int) func(int, int) int

Separating type and declared entity

Using an explicit separator like ':' between the type and the declared entity makes parsing the language significantly simpler, but it adds code.


Go uses entity name before type without separator symbol, there is a nice blogpost giving the rationale: Go declaration syntax rationale.