-
Notifications
You must be signed in to change notification settings - Fork 2
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
Support conditional access for function calls with args #7
Comments
What's the error when it fails? I'll take a look in a bit. |
I don't know how to capture the argument I was hoping for something like..
But when I enable these kind of templates then I get compile errors from your chained access tests ie..
Assuming this is possible the next question would be how to handle multiple arguments, and chaining |
I'm struggling to understand the error message from playing around with a small sample: https://play.nim-lang.org/#ix=3Md8 here an identifier is expected:
|
I see what's going wrong. The AST produced is using the wrong identifier for the call. Instead of using the last identifier of the conditional accessor, the first argument of the call node has to be the In otherwords if we have: DotExpr
Ident "d"
Call
Ident "foo"
IntLit 1 but it should be: Call
DotExpr
Ident "d"
Ident "foo"
IntLit 1 So a macro is required for that transformation. |
Ive just pushed an update that provides an alternative workaround for this by introducing a 'default coalesce' operator
I would like to prefer to implement this as just a
|
Nim doesn't have postfix operators. My preference is for the prefix anyways. Nice work! |
Not sure about the operator syntax '??' feels clunky and overloaded. What about |
With the new |
I renamed
|
Current conditional access templates fail to compile when matching function chains with extra args
The following fail to compile...
The text was updated successfully, but these errors were encountered: