language-rust icon indicating copy to clipboard operation
language-rust copied to clipboard

Add support for unquotation.

Open acw opened this issue 5 years ago • 2 comments

This set of patches adds in the ability to do unquotation in a variety of places:

  • As identifiers: [item| fn $$foo(x: u8) -> u8 { return 0; } |]
  • As expressions: [expr| 1 + $$(one) |]
  • As statements: ```[stmt| if x > 3 { $${something} } |]
  • As a series of statements: [stmt| if x > 3 { $@{somethings} } |]

... and so on. The syntax was not a particularly well-thought-out choice, and should be pretty easy to change if you don't like it. Right now, this only supports identifiers as the splice (e.g., $$(foo) but not $$(foo 4)); it wasn't super clear how to do this easily.

acw avatar Nov 01 '19 21:11 acw

I'll give this a thorough review this weekend - but I just wanted to quickly say thanks, because I've wanted this for a long time, and this PR looks like a splendid way of dealing with the problem!

harpocrates avatar Nov 01 '19 21:11 harpocrates

Hello! Just wanted to check in on this. There's a few missing things, still, like the ability to unquote-splice constant arrays, but mostly this seems to be working out for me in a little personal project. I'd be curious if you have any feedback, or if there's an easier way to make this all work.

acw avatar Jan 18 '20 04:01 acw