teikalang / teika

MIT License
318 stars 7 forks source link

Bind, hoist and parens #205

Open EduardoRFS opened 8 months ago

EduardoRFS commented 8 months ago

On the current design for the MVP, both bind and hoist can be wrapped in parens allowing for both (x = 1); K and (x : A); K this makes sense as ideally adding parens should not change meaning just precedence.

But if there is a desire to support direct effects without a unit, this is not ideal as (print "a" : ()); K can be both thought as a pattern and as a side effect.

Alternatively both bind and hoist should be forced to have no parens such as x = 1; K and x : A; K, this would mean that (x : A); K is different from x : A; K, which is likely not intuitive.

An advantage of also allowing the parens and forcing unit for side effects, is that let could in principle omit parens.

f x =
  y = x + 1;
  y + 2;