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

Operator overloading for basic combinators #1

Open
nicola-gigante opened this issue Feb 4, 2017 · 1 comment
Open

Operator overloading for basic combinators #1

nicola-gigante opened this issue Feb 4, 2017 · 1 comment

Comments

@nicola-gigante
Copy link

nicola-gigante commented Feb 4, 2017

Hi,

It would be nice to have operator| and operator+ as a shorthand for alt and seq.
Has it not be done already by design?
The many combinator could also be aliased by unary operator*, as in Boost.Spirit, but that's a bit more controversial since the standard syntax would be a postfix operator rather than prefix.

In any case, very well done library!

@grievejia
Copy link
Owner

Thank you for the comment!

Honestly speaking, I never thought this repo would draw interest from anyone other than myself, so I didn't put a lot of thoughts on ergonomics of the APIs. For my personal uses, I could live with seq, alt and many just fine, but I agree that operator| and operator+ could make the client codes much terser.

Off the top of my head, adding those overloads should be a fairly simple task. I'll try to do it when I got some time to spare. Again, I appreciate your suggestion.

Personally I don't quite like the pervasive uses of operator overloading in Boost.Spirit. Changing the meaning of unary * is also something that I try to avoid, as for my taste the readability improvement of it doesn't seem to justify the confusion it may potentially cause.

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

No branches or pull requests

2 participants