Some programming languages, notably Ruby, have the concept of a "natural" return from a function: the result of the last evaluation in a function is its return value, unless a return statement (& in Coem's case) is evaluated first.
I feel that this would be a useful addition to Coem, allowing a variety of linguistic opportunities without detracting from any existing functionality. Consider:
to know — future —:
if future is "known":
let freedom be "lost"
& false.
maybe.
This function, know, takes one parameter, future. If it's equal the string "known", then the (otherwise-unused) variable freedom is set to "lost and we return (&) the value false. So far so good.
The next line, which only occurs if future not "known", simply evaluates maybe. So the function returns either true or false at random. It doesn't need a & because it's implied by being the last evaluation in a function in which no & was hit.
In other words, this function returns false if passed "known", or randomly either true or false otherwise.
The language doesn't appear to specify this functionality already, although it's partially-implied by example sleep.coem that a naked string on the final line of a function might be returned else printed? (It's not entirely clear.)
Some programming languages, notably Ruby, have the concept of a "natural" return from a function: the result of the last evaluation in a function is its return value, unless a return statement (
&in Coem's case) is evaluated first.I feel that this would be a useful addition to Coem, allowing a variety of linguistic opportunities without detracting from any existing functionality. Consider:
This function,
know, takes one parameter,future. If it's equal the string "known", then the (otherwise-unused) variablefreedomis set to"lostand we return (&) the valuefalse. So far so good.The next line, which only occurs if
future not "known", simply evaluatesmaybe. So the function returns eithertrueorfalseat random. It doesn't need a&because it's implied by being the last evaluation in a function in which no&was hit.In other words, this function returns
falseif passed"known", or randomly eithertrueorfalseotherwise.The language doesn't appear to specify this functionality already, although it's partially-implied by example sleep.coem that a naked string on the final line of a function might be returned else printed? (It's not entirely clear.)