DenialAdams / roland

Roland programming language
https://www.brick.codes/roland
Apache License 2.0
46 stars 0 forks source link

Rename () to void #100

Closed DenialAdams closed 1 year ago

DenialAdams commented 1 year ago

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

DenialAdams commented 1 year ago

Could also rename it to unit

DenialAdams commented 1 year ago

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

DenialAdams commented 1 year ago

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 ();

DenialAdams commented 1 year ago

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?

DenialAdams commented 1 year ago

I went with unit, but I might wish it was void later