Skip to content

Support for macros returning macros? #298

Answered by mflatt
Gopiandcode asked this question in Q&A
Discussion options

You must be logged in to vote

The trick to nesting quotes in quotes is to use for the outer opening quote and »' for the outer closing quote:

defn.macro 'object_with_fields ....':
  '«class $name($field,...):
      ....
      dot '$('$') left . $field':
        ....
      ...
      »'

You can use ...»' in place of '...' anywhere, but the idea of using non-ASCII characters is that immediate quote nesting is relatively rare, so maybe it's ok to make that a little more difficult to type (but « and » are Option-\ and Shift-Option-\ on a U.S. Mac keyboard), and that way we don't use more valuable characters and combinations.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Gopiandcode
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