5 ms·
> This requires more standardization than one is likely to get. Not for the functionality - the only difference is that your compiler cannot tell you that you
by jlg23 10y ago
> This requires more standardization than one is likely to get.
Not for the functionality - the only difference is that your compiler cannot tell you that you are doing it wrong while a strict interface can be checked at compile time. But the standardization is there, it's just not explicit - your programm will crash/fail when you don't provide a proper callback that obeys the implicit contract (e.g.: takes 2 arguments, first the value, second the error if any; returns nothing).
- humanrebar 10y ago> the only difference is that your compiler cannot tell you that you are doing it wrong while a strict interface can be checked at compile time In most compiled languages with closures, the parameters are type-checked. In some, the return type is also type checked, but there are typically ways to add type checking to the return type if that's important.