Skip to content

How do I write a dangling macro? #881

Answered by yannham
glyh asked this question in Q&A
Discussion options

You must be logged in to vote

There's some discussion around it here, although no general purpose solution. I think depending on your use-case you might get around it using conditional macros (which avoid some of the duplication but are unfortunately undocumented currently).

You will find an example (although not related to dangling else) of a simple use of conditional macros to avoid code duplication, once again, in the Nickel grammar.

I haven't tried myself to tackle the dangling else problem (as Nickel is an expression-oriented functional language, so every if must have an else), so I can't really help further.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by glyh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants