MasonProtter / Bumper.jl

Bring Your Own Stack
MIT License
152 stars 6 forks source link

Reject all uses of `@goto` and `return` inside `@no_escape` #19

Closed MasonProtter closed 9 months ago

MasonProtter commented 9 months ago

It is very tricky to properly deal with code which uses @goto or return inside a @no_escape code block, because could bypass the mechanism for resetting the buffer's offset after the block completes.

I played with some mechanisms for cleaning it up, but they were sometimes incorrect if one nested multiple @no_escape blocks, so I decided that they should simply be disabled, and throw an error at macro-expansion time.

Because the old mechanism for cleaning up uses of return was actually incorrect (and I didn't handle @goto at all), I consider this change to be a bugfix, not a breaking change so I am only incrementing the minor version number.