4 ms·
One of the things he suggests is resource management, though, the file example. It would also be trivial to implement his vector sum example with syntactic suga
by lnanek2 11y ago
One of the things he suggests is resource management, though, the file example. It would also be trivial to implement his vector sum example with syntactic sugar designed for resource management. E.g. in Java's try with you would just square in the constructor of something that implements closeable, sum in the try-with block, then square root in the close method. Ruby is even easier since you would just pass a block into a method and the method could do pre and post operations before running the block. In both cases these things are usually used for resource management, but they can easily be used for this.
- coldtea 11y agoYou missed the part where the reverse operation is inferred automatically -- not just written explicitly to run in the end.