-
-
Notifications
You must be signed in to change notification settings - Fork 256
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
Error handling during process!-matchers #51
Comments
I was thinking about exactly the same way of implementing error handling, but I'm not completely sold on the idea of adding extra syntax sugar for this particular case. Passing the So, right now, the |
When I try to use the
Any idea what might be going wrong there? Example: main(&self) -> Result<Expr, ParseError> {
(z: main_z()) => {
let g = try!(z);
Ok(g)
}
}
main_z(&self) -> Result<Expr, ParseError> {
() => Ok(Expr::None)
} |
Yes. I've just realized that the usual kind of One solution would be to replace |
I cannot think of an appropriate syntax suggar right now, (Maybe creating an alias like Is that something that's doable at the moment or would both solutions require some work? |
Syntax sugar would be easy to implement. I was thinking maybe adding the
|
That would be cool, but would that work for "internal expressions" for example if you wanted to do: |
I was thinking about this, but it would definitely make everything really complicated behind the scenes, apart from overcomplicating the patterns. I think simple calls are enough. EDIT: we can discuss more on Gitter. |
so how would you then convert a hex-number in string from into an integer for e.g. AST-building ( Using |
Good point. I'll open up a separate issue. |
@steffengy I've fixed the issue. Here's an example of how it works now. |
works great so far 👍 |
I'm closing this for now. |
Are there any plans to introduce some syntax-sugar for error handling
during process!-matchers, to make error handling easier?
The only way I currently see is if for example every matcher returns a
Result<A, B>
,that you'd always have to do something like:
Some possible syntax sugar (without checking if it can be implemented):
Is there any better method to do it and what are your plans in this area as well as
for error handling generally?
The text was updated successfully, but these errors were encountered: