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

either alias thereis to any or new clause #60

Open
Luis-Henriquez-Perez opened this issue Apr 11, 2021 · 2 comments
Open

either alias thereis to any or new clause #60

Luis-Henriquez-Perez opened this issue Apr 11, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@Luis-Henriquez-Perez
Copy link
Contributor

So, any is a good (slightly better in my opinion) name than thereis. I made thereis modeling the specification of the iterate thereis clause. However, it contrasts from never and always in that it actually returns a value. Maybe, to be consistent the behavior with always and never, an any clause should strictly return a boolean.

I don't know whether this is overkill or not, but I could whip up a PR with alwaysis neveris clauses which contrast with their counterparts in that they return values as opposed to booleans.

@okamsn
Copy link
Owner

okamsn commented Apr 11, 2021

So, any is a good (slightly better in my opinion) name than thereis. I made thereis modeling the specification of the iterate thereis clause. However, it contrasts from never and always in that it actually returns a value. Maybe, to be consistent the behavior with always and never, an any clause should strictly return a boolean.

In loop, the always and never commands return only t or nil, but in iterate, they also return the values of the condition.

If the inconsistency bothers you, it is probably good to switch from the loop behavior to the iterate behavior.

I don't know whether this is overkill or not, but I could whip up a PR with alwaysis neveris clauses which contrast with their counterparts in that they return values as opposed to booleans.

I think that it would be overkill. Generally, a non-nil value works as well as t for checking a condition. Indeed, I learned of t as just a shorthand for "non-nil", as opposed to a needed specific value.

If one is relying on a difference between t and other non-nil values, then one could use the return command to return the correct value. An always (or never) command that returns a non-nil value (not just t) can already cover almost all use cases.

@Luis-Henriquez-Perez
Copy link
Contributor Author

If the inconsistency bothers you, it is probably good to switch from the loop behavior to the iterate behavior.

It does honestly. I'll make a PR for this. And being able to return something other than t or nil might be useful (if not abused of course).

I think that it would be overkill.

Thought it might be. Good thing I asked.

Generally, a non-nil value works as well as t for checking a condition.

True.

Indeed, I learned of t as just a shorthand for "non-nil", as opposed to a needed specific value.

That's cool I didn't now this.

@okamsn okamsn added the enhancement New feature or request label May 8, 2021
@okamsn okamsn mentioned this issue Jun 1, 2021
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants