[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
The IDENTITY function and multiple args
Date: Thu, 15 Oct 87 21:17:31 -0700
Is there a fundamental reason why #'IDENTITY and #'VALUES should be different?
VALUES seems like a much safer function to use for a "default" function,
since it will nicely consume any number of args and return them, which
is the same behavior that the improverished IDENTITY does for a single arg.
Why encourage programmers to make fragile programs by documenting "IDENTITY"?
Two reasons I see:
1, Intent: If the intent is to return one value based on one argument,
then IDENTITY is the correct function to use. It "is an error" to pass
it more or less than one argument, and some implementations "signal an
error." If the intent is to accept multiple values and pass them
through, then VALUES is the correct function to use. I don't consider
VALUES and "safer" or IDENTITY introducing "fragility". On the
contrary, I would claim that failure to program the intent will make the
program less safe and more fragile.
2, Efficiency (linguistically, this is a weak argument): some
(many?) implementations optimize the one return-value case. This makes
multiple values less efficient.