Vincent Manis wrote:
\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>

I don't yet have an opinion on using void, but this function would return either

a list: ( (void) )
or an alist: ( (salary . (void) )

depending on which we used to represent rows. Either way, there would indeed be a return value.

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


_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to