Radian has three sorts of definitions: variables which hold a value and can be reassigned, constants which hold a value and cannot be reassigned, and functions which may have parameters and can be invoked to return a value. (Objects, methods, generators, and tasks are all different types of functions.)
Constants bug me because they aren’t really constant in the sense I am used to from C++. The definition can’t be changed, but its value certainly may, when it is defined in terms of variables. What’s more, the difference between a constant and a one-line function without parameters is so slight that I can’t think of any way you could tell the difference in code.
The change I’m pondering would be to ditch
const entirely, then split the one-line function form apart from the block form. The new one-line simple definition statement would use the keyword
def, borrowed of course from Python and Ruby. The zero-parameter form of this statement would be equivalent to the current
const and to the current single-line parameterless
This change would regularize the syntax somewhat, in that each leading keyword would then unambiguously introduce either a single-line statement or a multi-line block. I haven’t been using
const much because it often feels wrong, especially as an object member, where the “constant” is often defined in terms of variables; I think I might use
def somewhat more.
The downside is that programmers familiar with Python or Ruby might find it jarring to find their familiar
def keyword set to a similar but rather more restricted use.