Implementation documentation for Unification - #134
Conversation
Did some minor formatting to make eyeballing the control flow easier. this formatting change can be reverted, it's not the more important part of the changes. I added some implementation documentation as I found the code hard to follow without context. I think this adds real value, and will save me time in the future when revisiting this code, and hopefully other contributors. I've annotated my comments with my name, primarily to avoid confusion about what code is commented out because its debug code that can be helpful, versus implementation documentation. I've also reordered the blocks in the macro to mirror the use of the macro in the " 'popping " loop. I've made some small changes where control flow in " 'popping " had branches that were unreachable, and left questions about why they were needed. The terminating if/else has bee replaced with a debug_assert, as the termination condition of popping was already guaranteeing that the stack was empty, but I though the debug asset kept the spirit of it as documentation.
|
I added some implementation documentation to apply_e. The code itself is unchanged. |
|
read through this properly since it documents the two functions i lean on most, and i checked it the docs match what i have hit independently. in particular "the occurs check here is actually the one real comment, on the it is correct today, and i verified that rather than assuming it. what i am uneasy about is that the invariant lives a thousand lines away in a different function, and two small things: the |
I did some minor formatting to make eyeballing the control flow easier. this formatting change can be reverted, it's not the more important part of the changes.
I added some implementation documentation as I found the code hard to follow without context.
I think this adds real value, and will save me time in the future when revisiting this code, and hopefully other contributors.
I've annotated my comments with my name, primarily to avoid confusion about what code is commented out because its debug code that can be helpful, versus implementation documentation.
I've also reordered the blocks in the macro to mirror the use of the macro in the " 'popping " loop.
I've made some small changes where control flow in " 'popping " had branches that were unreachable, and left questions about why they were needed.
The terminating if/else has been replaced with a debug_assert, as the termination condition of popping was already guaranteeing that the stack was empty, but I thought the debug_asset kept the spirit of it as documentation.