Plasma Language Ideas

Copyright (C) Plasma Team
Distributed under CC BY-SA 4.0

Updated: October 2017
Source: on github

Ideas to consider

Many of these should also wait until later. But this category is separate as I’m not sure that these are good ideas.

GC
  • Regions

  • Mark-compact for acyclic objects

Optimisations
  • Convert ANF to relaxed ANF then to PZ. Use the relaxed ANF to find single use variables and optimize them away to generate more efficient PZ. Do some other def-use analysis too, including for parallel tasks.

Types
  • Use structural matching to some degree, an instance can implement more than one interface, and may define more than an interface requires.

  • When supporting interfaces, maybe they can be integrated with the package system in a kind-of "does this package provide X?"

  • Evaluate HKTs.

  • Refinement types / path-aware constraints.

  • Use symbols like ? for maybe and | for or, like Flow Types.

  • Consider safe/unsafe integer operations such as overflows, division by zero etc. Allow checking for error to be done at the end of a complex calculation or by throwing an exception. + When implementing more subtyping, during an ambigious type which the value of a match expression, prefer the type (if there is one) that allows the match to "cover" the whole type, and provide that as guidance to the solver.

Syntax
  • Add field update and conditional field update syntax.

  • Maybe remove parens from if-then-else conditions and other places such as match parameters.

  • Guards on cases

  • Disjunctive patterns on cases

  • SISAL allows "masks" (like guards or filters) on returns clauses of loops. This looks pretty powerful.

  • More succinct loop syntax, for simpler loops.

  • Maybe allow simple loop outputs to be specified in the loop "head".

  • Consider different syntax & and ,? for combining multiple loop inputs in lockstep or Cartesian combinations.

  • List, array and sequence comprehensions.

  • Add a scope statement that contains a block allowing shadowing of some variables, and hiding of any produced variables.

  • Add let expressions?

  • Add something to allow statements within expressions?

  • Probably drop { } for dictionary constants in favor of [ ] with a ⇒ to separate keys from values. + Add more logical operators to the langauge, maybe xor and implication, probably via keywords or functions rather than symbols.

Semantics
Other
  • Read about Facebook reason wrt naming things and syntax.

  • Use command line parsing as example code for language & library.