Checked #564: "ANY and ALL are primarily used as control structures. As such, it might be good for unset! values to be skipped by both ANY and ALL, like noops." If that is what we want, then
Good point, even though #[unset!] counts as true for control functions. Ticket changed to reflect the new request - just put a copy of your comment in there and tweaked the code.
Rebolbot commented on May 27, 2009:
Submitted by:Ladislav
I guess that it is possible to change the implementation of All so that #[unset!] is completely ignored, i.e., that
This is clearly a point of confusion overall. I'll note that at time of writing, Red says:
>> all []
== none
>> all [()]
;-- no result
I guess that it is possible to change the implementation of All so that #[unset!] is completely ignored, i.e., that
all [1 ()]
Originally in Ren-C this was the implementation choice, because NULLs were "neither true nor false". This was a feature inspired by the desire to have ways to print output in the middle of an ANY or an ALL without disturbing the logic of it (picking either true or false would disturb one or the other). Hence NULLs would "opt out" of ANY and ALL.
Beyond having functions that would always opt-out, this feature speculated a little bit on being a kind of arbitrary tristate...where one might have a routine that could return a truthy value, a falsey value, or a NULL... thus either voting yes or no or abstaining. Building in such a feature is kind of random, and actually got in the way of much more mainstream needs of the "non-value" status of NULL.
But when "invisibles" came on the scene, they provided new features such as ELIDE to take care of most opting-out scenarios. And it really just began to make more and more sense to consider NULLs as falsey, which Ren-C now does:
And all failed ALLs return null as well, not blank. So all [()] = (), basically...and x: all [false] will error, because there is no actual value to be assigned. If this is okay, you have to say so explicitly with x: try all [...]
In light of this, it makes perfect sense that all [] should also be null...which offers the consistency sought in this issue. So the previous synthesis of a truthy value is now removed:
Clearly no one would be writing all [] in source anyway, so this would only come up in generated or composed code. That code could solve this problem by putting whatever result it wanted in at the tail, such as all [... true], or use one of the many null-handling operations in Ren-C, e.g. all [...] else [...]
In Ren-C, further changes have affected this issue...because GROUP! no longer synthesizes any values...it only groups them.
>> 1 + 2 ()
== 3
Hence ALL does not have the opportunity to differentiate all [()] and all []...it is running the evaluator and deferring to it, and in doing so sees nothing. It would be the same as all [comment "Hi"] as well.
There's no special code in ALL needed for this transparency--it just emerges from the new properties of GROUP!.
Submitted by: Ladislav
Checked #564: "ANY and ALL are primarily used as control structures. As such, it might be good for unset! values to be skipped by both ANY and ALL, like noops." If that is what we want, then
has to yield the same result as
i.e. True, not #[unset!], etc.
Imported from: CureCode [ Version: alpha 54 Type: Bug Platform: All Category: n/a Reproduce: Always Fixed-in:none ] Imported from: https://github.com/rebol/rebol-issues/issues/850
Comments:
Submitted by: BrianH
Good point, even though #[unset!] counts as true for control functions. Ticket changed to reflect the new request - just put a copy of your comment in there and tweaked the code.
Submitted by: Ladislav
I guess that it is possible to change the implementation of All so that #[unset!] is completely ignored, i.e., that
would yield 1, etc.
This is clearly a point of confusion overall. I'll note that at time of writing, Red says:
Originally in Ren-C this was the implementation choice, because NULLs were "neither true nor false". This was a feature inspired by the desire to have ways to print output in the middle of an ANY or an ALL without disturbing the logic of it (picking either true or false would disturb one or the other). Hence NULLs would "opt out" of ANY and ALL.
Beyond having functions that would always opt-out, this feature speculated a little bit on being a kind of arbitrary tristate...where one might have a routine that could return a truthy value, a falsey value, or a NULL... thus either voting yes or no or abstaining. Building in such a feature is kind of random, and actually got in the way of much more mainstream needs of the "non-value" status of NULL.
But when "invisibles" came on the scene, they provided new features such as ELIDE to take care of most opting-out scenarios. And it really just began to make more and more sense to consider NULLs as falsey, which Ren-C now does:
https://github.com/metaeducation/ren-c/pull/816
And all failed ALLs return null as well, not blank. So
all [()] = ()
, basically...andx: all [false]
will error, because there is no actual value to be assigned. If this is okay, you have to say so explicitly withx: try all [...]
In light of this, it makes perfect sense that
all []
should also be null...which offers the consistency sought in this issue. So the previous synthesis of a truthy value is now removed:https://github.com/metaeducation/ren-c/commit/e8ab17a7d017a6bc7fc4df40a07aae588b0f36c7
Clearly no one would be writing all [] in source anyway, so this would only come up in generated or composed code. That code could solve this problem by putting whatever result it wanted in at the tail, such as all [... true], or use one of the many null-handling operations in Ren-C, e.g. all [...] else [...]
In Ren-C, further changes have affected this issue...because GROUP! no longer synthesizes any values...it only groups them.
Hence ALL does not have the opportunity to differentiate
all [()]
andall []
...it is running the evaluator and deferring to it, and in doing so sees nothing. It would be the same asall [comment "Hi"]
as well.There's no special code in ALL needed for this transparency--it just emerges from the new properties of GROUP!.
https://forum.rebol.info/t/what-to-do-about-do-and/772