On Mon, 2009-10-05 at 10:36 -0400, Richard Hennessy wrote:
> Let me tone down my statement. There should be a way to have a function
> return nothing, sort of like programming languages that allow subroutines as
> well as functions. I don't like having to always return a value, it forces
> me to return something random that could cause problems later. It is not a
> panacea but it is a possible improvement in the programming language.
The family of functional programming languages do not have
"subroutines", only functions, and all functions return values. Both
the ML and Haskell families have the concept of the "bottom" value,
which corresponds to "undefined". You can think of "undefined" as a
type with a single value; it is used to extend partial functions to
total by having them evaluate to "undefined" for any value not in their
domain. Functional programmers are quite comfortable with having all
functions return values.
I have the uneasy feeling that we are blurring the distinction between
object language, mathematics in this case, and meta language, the
language in which we talk about the object language. Interestingly
enough the functional programing language ML started out as the Meta
Language for an object language of computable functions.
--
Bill Wood