Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ALL [()] should have the same result as ALL [] #850

Closed
rebolbot opened this issue May 25, 2009 · 3 comments
Closed

ALL [()] should have the same result as ALL [] #850

rebolbot opened this issue May 25, 2009 · 3 comments

Comments

@rebolbot
Copy link
Collaborator

rebolbot commented May 25, 2009

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

all [()] 

has to yield the same result as

all [] 

i.e. True, not #[unset!], etc.

equal? type? all [()] type? all [] ; yields False

CC - Data [ Version: alpha 54 Type: Bug Platform: All Category: n/a Reproduce: Always Fixed-in:none ]

@rebolbot
Copy link
Collaborator Author

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.

@rebolbot
Copy link
Collaborator Author

rebolbot commented 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

all [1 ()]

would yield 1, etc.

Oldes added a commit to Oldes/Rebol3 that referenced this issue Oct 7, 2018
related issues:
metaeducation/rebol-issues#564
metaeducation/rebol-issues#850

It reverts changes discussed in above issues as I consider this behavior to be more useful and it is compatible with Rebol2 and Red.

My main reason is to be able use PRINT inside ALL blocks without need to worry if these would affect the evaluation.

Like in this case:
```
	if all [
		not headers
		any [
			all [
				d1: find conn/data crlfbin
				d2: find/tail d1 crlf2bin
				print "server using standard content separator of #{0D0A0D0A}"
			]
			all [
				d1: find conn/data #{0A}
				d2: find/tail d1 #{0A0A}
				print "server using malformed line separator of #{0A0A}"
			]
		]
	][ ... ]

```
@hostilefork
Copy link
Member

hostilefork commented Oct 23, 2018

In Ren-C, 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!.

https://forum.rebol.info/t/what-to-do-about-do-and/772

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants