-
I was thinking about why do we need to prevent the stack pollution... why do we need? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Well, it's something I introduced relatively recently as an effort to make min programs easier to reason about and less error prone. While you could just keep putting things on the stack and use it to manage state, typically I noticed that it causes more harm than good, and it's much better to be 100% sure that a file you are requiring doesn't add extra elements to the stack. I tried using min without stack pollution checks, signatures and requires (and you can still can just using lambdas), and it was much harder than it is now I must say: I can now read a program days/months later and understand what it does. But if I look at something like this (which I have to update and refactor sooner or later)... https://github.com/h3rald/h3rald/blob/master/rules.min 🤯 ...and it's not too bad, even. |
Beta Was this translation helpful? Give feedback.
Well, it's something I introduced relatively recently as an effort to make min programs easier to reason about and less error prone.
While you could just keep putting things on the stack and use it to manage state, typically I noticed that it causes more harm than good, and it's much better to be 100% sure that a file you are requiring doesn't add extra elements to the stack.
I tried using min without stack pollution checks, signatures and requires (and you can still can just using lambdas), and it was much harder than it is now I must say: I can now read a program days/months later and understand what it does. But if I look at something like this (which I have to update and refactor soon…