Comment

Comment by abaines

I feel as though they should change the name of the paper, because this must be one of the most complex takes on 'defer' that I have seen.

They make a classic mistake of trying to solve a problem by adding more complexity. They cannot decide on by-value or by-reference, so they take the convoluted C++ syntax to allow specifying one (as well as other semantics?).

It does not fit with C in my opinion. It will also hurt third party tools that wish to understand C source code, because they must inherit this complexity.

I would prefer a solution where they simply pick one (by ref / by value) and issue a compiler warning if the programmer has misunderstood. For example, pick by-value and issue a warning if a variable used inside the defer is reassigned later in the scope.

parent abaines 4 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton