News for hackers. Stuff that matters.
Re:Implementing Go's defer keyword in C++ by asdfaoeu on Sunday October 22, 2017 @02:11AM (#15525414)
You can do basically the same thing in python

    @contextlib.contextmanager
    def open(*args)
        # file open
        try:
            yield file 
        finally:
            file.close()

    with open(args) as file:
        # use file
Re:Implementing Go's defer keyword in C++ by RX14 on Sunday October 22, 2017 @07:28AM (#15526257)
That's pretty cool!

But as nice as it is, to me it's just syntax sugar over the wrong abstraction instead of something beautiful in it's own right.