Stefan Karpinski wrote: > The modification I've occasionally considered would be: > > * short-form functions implicitly return their expression value; > * long-form functions implicitly return `nothing` unless an explicit value is > returned.
What's returned by a function (in a functional context where everything is an expression) is a matter of language semantics. If you go down that road, you're introducing semantic discrepancies out of syntactic context. Consider that you would no longer be able to talk about the concept of "function" itself, separate from the way a function object was constructed (in other words, you increase the porosity of the syntax/semantic membrane). I think this is a bad idea. It's traditional in impure functional languages to return the value of the last expression from compound statements; the former ones only making sense by side-effecting. Lisp has some constructs to allow you to return the value of previous sub-expressions instead, and we idiomatically use (values) to explicitly indicate intent to return nothing. I can see why some people may be bitten by accidentally returned values and would like to get 'nothing' by default, but in a multi-paradigm language like this one, especially when functional is prominent, it's not the language that needs to be fixed. It's the people ;-). They're simply not programming in a functional style enough and they should learn to do so. It's a long-term gain anyway. -- Resistance is futile. You will be jazzimilated. Lisp, Jazz, Aïkido: http://www.didierverna.info