Open phipsgabler opened 5 years ago
This is possible, of course, but really fiddly. @dynamo
exists because it's pretty much impossible to get this right first try (it always takes me multiple attempts as well).
We could dig into why this isn't working, but if you just want to add a new argument you probably don't need to, you can do this with @dynamo
. You just need something like
@dynamo function foo(f, cx, args...)
ir = IR(f, args...)
cx = argument!(ir, at = 2)
...
end
Hm. For some reason, just using argument!
didn't work when I tried it, but now it does :) Thanks, that question is settled now.
I tried to disassemble and understand the process of how dynamos are working, and reasoned about what would be equivalent the following dynamo:
Naively substituting the code pieces in dynamo.jl, I thought the following should work:
But instead, it crashes:
No idea if that's a legitimate use case that should have worked. What I actually wanted to achieve was to get a dynamo that adds a new argument to the given method.