[Pitch][Swift 5?] #dup "macro", i.e. Entity Duplication

I posted a revision (2) of the entity duplication <https://gist.github.com/CTMacUser/44afa75e379ec70201391af3a39bcdeb>. I added the ability to use the index placeholder as a closure anonymous argument, i.e. parameterize “$0,” “$1,” etc. with “$($$0).” I thought a direct triple-dollar-sign would be confusing, from determining which order the “$” and “$$” bind (or if it’s yet another new token).

I don’t think anyone has looked at this yet. I do want it for Swift 5, if possible. It’s the dual to variadic parameters/arguments; for producing comma-separated lists (instead of consuming), but can be used for non-variadic stuff too. “constexpr” would help, but it’s not necessary. It would complement variadic generics, if added.

I want to know if the grammar scheme (the one in the “Grammar” section, not the troll version a few paragraphs before) is the good approach. And if the idea is even feasible to implement.

···


Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com

Terms of Service

Privacy Policy

Cookie Policy