usethesource / rascal

The implementation of the Rascal meta-programming language (including interpreter, type checker, parser generator, compiler and JVM based run-time system)
http://www.rascal-mpl.org
Other
406 stars 78 forks source link

remove constructor type reference from the language #1679

Open jurgenvinju opened 2 years ago

jurgenvinju commented 2 years ago

Describe the bug

Statemenf.if x = [Statement] "if x then y else z fi";

and

if (Statement.if _ := [Statement] "if x then y else z fi") {
   ...
}
  1. I bet this is never used
  2. documentation contains obscure error message: https://new.rascal-mpl.org/docs/compiletimeerrors/ambiguousfunctionreference/ which is wrongly documented

Constructors are types in vallang, but for no good use. Perhaps this was a unification step too far in 2007/2008. In Rascal constructors are not used as types. Constructor functions are used as functions, and they have a function type, and constructors are used to create constructor trees of the algebraic datatype they belong to.

So the proposal is to remove this feature entirely:

  1. From the interpreter, throwing errors when it is used (not implemented)
  2. From the syntax definition of Rascal itself
  3. From vallang by changing class ConstructorType extends Type to class Constructor.
  4. The final step would also align vallang semantics with the semantics of the Type and ParseTree standard library modules.
jurgenvinju commented 2 years ago