[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Destructuring and &whole
The point has been made that &whole might be used for detecting failed
attempts at destructuring, but has been countered by the observation that
the CL standard doesn't say anything about what happens if destructuring
doesn't work. This greatly limits the usefulness of destructuring - persons
writing robust code must do all the dissection by hand. (This situation
also comes up in functional languages, whose proponents frequently boast of
the destructuring capability inherent in function calls, but who shrug if a
program fails utterly because of an argument mismatch.)
I see several choices, listed in order of difficulty:
1. Flip a coin to decide whether &whole can appear in several places or not,
change nothing else.
2. Specify some sort of behavior for anomalous situations during dissection,
perhaps no more than a condition to be handled by the error system.
3. Augment destructuring syntax to allow for several possibilities to be
tried in order. For instance, the two forms of defsetf could be decided
upon, based only on multiple patterns in the parameter list!
I favor the last, but it's probably not politically feasible :-). Perhaps