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

Implicitly coerce to string left operand of =~ and !=~ operators #259

Closed
divtiply opened this issue Aug 7, 2019 · 4 comments
Closed

Implicitly coerce to string left operand of =~ and !=~ operators #259

divtiply opened this issue Aug 7, 2019 · 4 comments
Labels
go-port Things which will be addressed in the Go port AKA Miller 6

Comments

@divtiply
Copy link

divtiply commented Aug 7, 2019

To prevent (IMO very non-descriptive) error for expressions like this

$ echo x=123 | mlr filter '$x =~ "^[0-9]+$"'
Expression does not evaluate to boolean: got MT_ERROR.

I know I can coerce explicitly, but I see no reason for this

$ echo x=123 | mlr filter 'string($x) =~ "^[0-9]+$"'
x=123
@divtiply divtiply closed this as completed Aug 7, 2019
@divtiply
Copy link
Author

divtiply commented Aug 7, 2019

Intended miller way is

$ echo x=123 | mlr filter -S '$x =~ "^[0-9]+$"'
x=123

See issue #150 and FAQ

@johnkerl johnkerl reopened this Aug 31, 2020
@johnkerl
Copy link
Owner

johnkerl commented Aug 31, 2020

In the spirit of #151 this will be handled better in the future, without need for -S.

@johnkerl johnkerl added the go-port Things which will be addressed in the Go port AKA Miller 6 label Sep 15, 2020
@johnkerl
Copy link
Owner

johnkerl commented Oct 17, 2021

@divtiply this already works in Miller 6 -- sorry I didn't close this out sooner! :)

$ mlr --version
Miller v6.0.0-dev

$ echo x=123 | mlr filter -S '$x =~ "^[0-9]+$"'
x=123

@aborruso
Copy link
Contributor

thank you very much @johnkerl

@johnkerl johnkerl removed the active label Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go-port Things which will be addressed in the Go port AKA Miller 6
Projects
None yet
Development

No branches or pull requests

3 participants