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

Extending %|_|% #112

Open
jthompson-arcus opened this issue Oct 16, 2024 · 1 comment
Open

Extending %|_|% #112

jthompson-arcus opened this issue Oct 16, 2024 · 1 comment
Labels
question Further information is requested

Comments

@jthompson-arcus
Copy link
Collaborator

The infix function %|_|% added with #104 has an issue if the LHS is an expression instead of an object.

## returns mtcars
mtcars %|_|% iris

## returns iris and throws no warning
head(mtcars) %|_|% iris

Should the function be expanded to handle expressions? Currently the function is fairly lightweight this would add complexity and weight with no clear benefit.
Should the function detect the difference between an object and an expression? Should it throw a warning in such a case?

@jthompson-arcus jthompson-arcus added the question Further information is requested label Oct 16, 2024
@LDSamson
Copy link
Collaborator

LDSamson commented Oct 30, 2024

My issue with it that, by using it in combination with an expression, it silently returns the value that we are not expecting, which I think is a risk in using this function.

If it is easy to implement, I think ideally it should error (with an informative message) in case an expression is provided. Alternatively, if this is difficult to implement, then we can say that we accept the risk since only core developers will use it, but should be clearly documented with the function that the function should not be used with expressions to protect our future self's from making this mistake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants