PsiQ / bartiq

Bartiq
https://psiq.github.io/bartiq/
Apache License 2.0
31 stars 9 forks source link

Fix handling root name in `_compile_routine` #53

Closed mstechly closed 4 months ago

mstechly commented 5 months ago

When refactoring bartiq I left the following comment in _compile:

# NOTE: Old compilation algorithm was written with the assumption that root is always an empty string.
# The fact that remove the name and then add it back at the end is a hack solution and needs to be fixed in future.

To get around it I introduced this logic:

    root_name = routine.name
    routine.name = ""
    ...
    compiled_routine_with_funcs.name = root_name

We should get rid of this logic and fix the compilation logic that it does not make any assumptions about naming of root (or any other subroutine).