Whiley / RFCs

Request for Comment (RFC) proposals for substantial changes to the Whiley language.
3 stars 2 forks source link

Distinguish Constants from Static Variables #107

Open DavePearce opened 2 years ago

DavePearce commented 2 years ago

(see also RFC#0008)

Currently, constants are implemented as final statics. However, it may make sense to actually distinguish this. For example, we could have:

constant int x = 1
static int y = 2
final static int z = 3

Its not clear to me what the value of a final static would be. However, the key difference is that constants would not be inlined, and would not be usable in certain contexts. Observe that this distinction follows Rust.