4 ms·
This reminds me of Eiffel, where loop (in)variants had to be explicitly declared, as part of its design-by-contract dogma.
by mhd 11y ago
This reminds me of Eiffel, where loop (in)variants had to be explicitly declared, as part of its design-by-contract dogma.
- phpnode 11y agoI wrote a Babel plugin which brings a similar syntax to JavaScript, so you can write this: for (let i = 0; i < someVar; i++) { invariant: i < 10000; console.log(i); } along with other kinds of contract, like preconditions and postconditions - https://github.com/codemix/babel-plugin-contracts https://github.com/codemix/babel-plugin-contracts