Skip to content

A list of quirks and divergences from Enforce "specifications" #7

Description

@simonvic

We don't have official specifications about the language grammar other than the wiki page, scattered information across forums and discords, and observations from compiling the code with the tools provided.

Also, the same language is used for different game/engines and it may have differences between versions.

For these reasons a bunch of arbitrary and opinionated choices have been taken that may cause this grammar not to be 100% up to spec.

Here is a list of quirks, differences and unclear specifications

  1. In Enforce, classes can be named with just a number, a string literal, an underscore and possibly more.
    This grammar only allows an identifier to be a classname.

  2. Whitespaces are not ignored

void foo() {
  return // empty return
  69; // statement_expression
}

With this grammar, the previous example would be parsed as only one return statement.

  1. In Enforce, arrays and enum entries can be separated by a newline rather than a comma.
    This grammar doesn't allow it.
  2. Parenthesis can be omitted in instantiations new SomeType;
  3. In Enforce, visibility modifiers are allowed (but unused?) for formal parameters
  4. enum can be nested in classes (but not be used?)
  5. Generic types can be upper bounded by native only types, but no visible difference is noticed
    7.1. Generic type with primitive upper bound, cannot be instantiated without a "wrong number of template parameters" compile error
  6. In Enforce, attributes list can be empty.
    This grammar doesn't allow it
  7. More?

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions