chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

void as a return value (Re: [Chicken-users] DBI)


From: Vincent Manis
Subject: void as a return value (Re: [Chicken-users] DBI)
Date: Wed, 27 Feb 2008 14:42:38 -0800

\begin{rant}
On the subject of using void as a return value (rather than to indicate that
a function or method doesn't return anything), EWWWW.

Please, please, don't ever write functions that return void as anything other
than an indication that no value was returned.

#;44> (car (db-fetch-row (db-query "select salary where empname='Bilbo Baggins'")))
#;45>

So now, (a) you get no output, which might be mystifying and (b) car is now returning void. Neither of these violates any language rule, but each violates the Law of
Least Astonishment.

For SQL nulls, one could use '(), as has been mentioned; alternatively, an object called the-SQL-null-object could be created (perhaps as a record type value).

Incidentally, there are several different meanings for null in SQL, including no information, not applicable, no value presently exists (but one might in the future), etc. You can find lengthy essays on the appropriateness of using NULL in several of Chris Date's `Writings on Database' books. People have enough trouble understanding SQL null without further conflating it with `this function returns no values'.

\end{rant}

Sorry :-) -- vincent




reply via email to

[Prev in Thread] Current Thread [Next in Thread]