Hi everyone. I have some java code I'm porting and I've never seen this try
form before
try ( MemoryStack stack = stackPush() ) {
...
}
how is the part that appears inside the ()
executed? Why is it not inside the try
block after the {
?
It is some kind of auto try/finally with-*
kind of context manager?
because at the end the demo code says:
} // the stack frame is popped automatically
ok found this: https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html
and that led me to https://stackoverflow.com/questions/46670958/try-with-resources-in-clojure
So I just use (with-open [stack (stackPush)] ...)
:the_horns: