Yes, that works generally. An implementation is not permitted to implement (values) by returning NIL because that would be detectable by multiple-value-list for example.
The "primary value" is used in cases where a form has to yield a value, such as in a let binding or as an argument to a function. In those cases, nil is used if there are zero values.
(when nil (values)) will always return one value, nil, because (values) is never evaluated there. Likewise, (when t (values)) will always return zero values.
__Martin
On Fri, 9 Jun 2023 08:35:29 -0500, Robert P Goldman said:
Does that generally work, or is an implementation permitted to implement (values) by returning NIL?
In the description of “primary value” in the hyper spec, I see the following:
primary value n. (of values resulting from the evaluation of a form) the first value, if any, or else nil if there are no values. ``The primary value returned by truncate is an integer quotient, truncated toward zero.''
Does that license `(when nil (values))` to return NIL?
-- Robert P. Goldman
On June 9, 2023 at 08:23:46, Martin Simmons (martin@lispworks.com(mailto:martin@lispworks.com)) wrote:
Another possible fix is to always return zero values, e.g.
#.(progn (when (uiop:getenv "HOMEBREW_PREFIX") (pushnew :homebrew *features*)) (values))
__Martin
> On Thu, 08 Jun 2023 16:32:36 -0500, Robert Goldman said:
This one was my fault. I did the PR with this patch, because cl-libuv wouldn't build on my Mac. Since there's no testing, apparently, it slipped through.
I don't know how to fix this, because I have never used CFFI-grovel, so no idea how to put Madhu's advice into practice.
As an aside, doesn't this kind of break Faré's design principle that the person who has the information is the one who should be configuring the software? It seems like we are expecting the programmer to guess ahead of time what are all of the possible locations for the foreign library and includes. Wouldn't it make more sense for this to be configurable?
Of course, this is partly my fault, since ASDF does not support configuring operations, except with gross dynamic variables.
On 8 Jun 2023, at 15:32, Attila Lendvai wrote:
FTR, Madhu's analysis has been forwarded to the author:
https://github.com/orthecreedence/cl-libuv/issues/23
-- • attila lendvai • PGP: 963F 5D5F 45C7 DFCD 0A39 -- “Nobody in the world, nobody in history, has ever gotten their freedom by appealing to the moral sense of the people who were oppressing them.” — Assata Shakur (1947–)