Closed DenialAdams closed 1 year ago
Could also rename it to unit
Could just remove unit literals entirely:
proc unit() -> () {} return unit()
This feels very clean, but will be worse for performance at least until we have inlining
Could just remove unit literals entirely:
proc unit() -> () {} return unit()
This feels very clean, but will be worse for performance at least until we have inlining
I really liked this, but it doesn't work because unit is a keyword in this scheme and so it can't be the name of a procedure (duh)
Also, we actually use UnitLiteral expressions internally to the compiler for reasonable things like
return; // equivalent to return ();
The parser knows when we're in a type context. So, unit wouldn't have to be a keyword
let unit: unit = unit() would be odd though?
I went with unit, but I might wish it was void later
We don't have tuples so () is a bit silly
Using void in a value context might feel weird though. But then again, using it in a value context is a weird thing to do