Fork me on GitHub
#off-topic
<
2019-12-19
>
Vincent Cantin16:12:23

For those who saw the movie Inception … I present you the Macroception - a macro defined in a macro https://github.com/clojure/spec-alpha2/commit/e4ae2603c055950a1b9e649e6fdb022e109fabaf#diff-30b3955ecb734ef29c10aa50217b5066R934

rich 12
hammock 4
4
godmode 8
borkdude16:12:53

For lack of an Alex icon.

souenzzo16:12:39

:puredanger: please

Alex Miller (Clojure team)16:12:17

most annoying f'ing code I ever wrote

16
😆 4
Vincent Cantin16:12:36

I was wondering if it was possible to use a double syntax quote .. lol

borkdude16:12:00

yes... (in general, not referring to any specific code)

Vincent Cantin16:12:02

to avoid the (list inside

Alex Miller (Clojure team)16:12:31

well, that particular code is mostly a dupe of defop - that was the annoying part (defcompop mostly copies it)

Alex Miller (Clojure team)16:12:11

It's probably possible to DRY it out, but I assume that would be even worse

😱 4
borkdude16:12:14

Great line for on defn podcast btw. @U04V5V0V4 maybe you should re-invite Alex, it's been almost 50 episodes 🙂

Alex Miller (Clojure team)16:12:31

defcompop is speculative, may not survive

Alex Miller (Clojure team)17:12:28

@U8MJBRSR5 it is possible, but there are some very subtle tradeoffs and I found this was easier

borkdude17:12:40

sometimes duplicating is worth it

Alex Miller (Clojure team)17:12:16

a smarter person than me could probably improve that code

Vincent Cantin17:12:56

I left a dependency on spec alpha2 in my current project even if I don’t use it yet, because I am happy to see a new git commit hash each time I update my deps to their latest version.

Alex Miller (Clojure team)17:12:33

fyi, recent commits renamespaced, and prob going to change the project name too, which will break any dependees

Alex Miller (Clojure team)17:12:06

but back to defop/defcompop - these were really interesting to work through. they do highlight the downsides of the macro-expander approach in spec (requiring macros to do composition)

4
Alex Miller (Clojure team)17:12:31

if you don't care about the "language" side of specs (only about the programmatic side), that's not technically necessary anymore in spec 2 though