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
This is probably bad practice to modify the tree while you're walking into it.
I ask because the first filters I wrote with panflute were heavily modifying the element. Now I have to rewrite these filters so that instead it returns a new element.
Should panflute not prevent the modification of the element to prevent side-effects? I don't know how; the only way I'm thinking about would be to use a copy of the element instead of the element when calling walk recursively, but it would make the code slower.
The text was updated successfully, but these errors were encountered:
Hi,
the documentation of pandoc says about action functions given to walk:
but doesn't being able to modify the element encourage writing filters in a bad way?
For instance in this issue #96 (comment), someone was trying to modify the parent from the child. This is also what's done here:
panflute/examples/panflute/deemph.py
Lines 17 to 19 in c4e8125
This is probably bad practice to modify the tree while you're walking into it.
I ask because the first filters I wrote with panflute were heavily modifying the element. Now I have to rewrite these filters so that instead it returns a new element.
Should panflute not prevent the modification of the element to prevent side-effects? I don't know how; the only way I'm thinking about would be to use a copy of the element instead of the element when calling walk recursively, but it would make the code slower.
The text was updated successfully, but these errors were encountered: