You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I came across this library and I must say I am really happy to have it.
However, there is a critical issue that blocks basically every real-case use of this. This is related to the fact that arguments of calls are tracked by reference, and so if some arguments are changed during or after the call (side-effect), then the rendering visualizes the updated values and not the original values used when the call was made. The problem is that one cannot implement a workaround in the tracked procedure without removing the side-effects on the arguments.
Example:
suppose there is a quicksort procedure that does not relies on comprehension, e.g.:
def quicksort(a, i, j):
if i < j - 1:
k = partition(a, i, j)
quicksort(a, i, k)
quicksort(a, k + 1, j)
When this procedure is tracked, e.g. with decorator @rcviz.viz, the rendered tree shows the same content for the array argument a, since this is stored as a reference.
I think a possible fix to this is to edit the init method in the file node_data.py, replacing
Of course one needs to import the python module copy
BTW. it seems something similar is already done for auxdata.update when adding user assigned track data.
PS. I have created a pull request with the suggested fix.
The text was updated successfully, but these errors were encountered:
Thanks for the issue and the PR. I can see this being a problem if each invocation does not create the variable on the stack, and instead mutates it in place and passes it down. Please could you add a file in examples/ showing the failing case? Otherwise LGTM.
I came across this library and I must say I am really happy to have it.
However, there is a critical issue that blocks basically every real-case use of this. This is related to the fact that arguments of calls are tracked by reference, and so if some arguments are changed during or after the call (side-effect), then the rendering visualizes the updated values and not the original values used when the call was made. The problem is that one cannot implement a workaround in the tracked procedure without removing the side-effects on the arguments.
Example:
suppose there is a quicksort procedure that does not relies on comprehension, e.g.:
def quicksort(a, i, j):
if i < j - 1:
k = partition(a, i, j)
quicksort(a, i, k)
quicksort(a, k + 1, j)
When this procedure is tracked, e.g. with decorator @rcviz.viz, the rendered tree shows the same content for the array argument a, since this is stored as a reference.
I think a possible fix to this is to edit the init method in the file node_data.py, replacing
with
Of course one needs to import the python module copy
BTW. it seems something similar is already done for auxdata.update when adding user assigned track data.
PS. I have created a pull request with the suggested fix.
The text was updated successfully, but these errors were encountered: