core-async

weavejester 2024-10-22T19:39:43.324939Z

Since the go macro rewrites its body into a state machine, I'm wondering how it deals with macros, if at all. I'm running into some opaque errors when using custom macros within a go block that makes me think it's screwing up the state machine generation.

2024-10-22T19:58:58.472789Z

Macros are expanded away before rewriting, but they are expanded using tools.analyzer which isn't necessarily exactly the same expansion environment as what you get from the compiler

weavejester 2024-10-22T20:00:02.637339Z

Ah, that might be what's causing my issue then, since I'm making use of &env.

2024-10-23T02:40:27.871809Z

I don't know about tools.analyzer, but Ridley will handle &env properly: https://github.com/xadecimal/riddley

2024-10-23T02:45:47.150369Z

I do wish the compiler exposed a macroexpansion that was exactly the same it used though.

2024-10-23T02:56:21.308539Z

The problem is &env leaks compiler internals, the values in the map are whatever internal class in the compiler

2024-10-23T02:58:52.781349Z

tools.analyzer does pass &env when it does macro expansion, but it uses its own locals representation as the values in the env map instead of trying to instantiate what the compiler uses

weavejester 2024-10-23T06:05:03.583999Z

I'm unsure what exactly is going on, but I'm getting a Too many arguments in method signature in class file error, so I think maybe there's some feedback loop going on between go and my macro, though adding debug statements to my macro doesn't reveal anything off.

weavejester 2024-10-23T06:06:28.749139Z

I think I'll try redesigning it and hope the new version works. As clever as core.async is, it does have some rather gnarly edge conditions.

2024-10-23T06:27:11.515839Z

That is interesting, to my knowledge the fns generated by the go macro all take just a few args

weavejester 2024-10-23T06:48:28.112269Z

I did think it was one of the functions that my macro generated, but when I put a few print statements into my macro that didn't seem to be the case. However, I believe I can take out the go-blocks until the last stage, which should prevent bad interactions between my macro and the go macro.