Christoffer Lerno

Results 1219 comments of Christoffer Lerno

@bvdberg of course one would use variables in defer.

You’re marking obvious requirements ”useless”. I can’t shake the feeling that you’re thinking of some completely different feature.

I will rebase this one, then add more tests, but the feature I **NEED** is defer that works at the end of scope. At function end is **NOT USEFUL** and...

One thing not handled: ``` switch (foo) { case 1: defer close(bar); case 2: printf("b"); } ``` Presumably defer should trigger on leaving the switch if foo == 1. Right?

I'm adding test cases for switch and also make sure that it generates the correct C code.

From what I've read now, switch should be treated as a goto with labels, so we can rewrite it (in terms of analysis) like this: ``` { if (foo ==...

Function scope defer cannot be implemented without a runtime.

Also, tail call optimization is only prevented for function-defer. So function-defer: - needs runtime - prevents tail-call optimization You end by ”that’s why I prefer function scope”. But I don’t...

You can have function style scope withou runtime by excluding defers from jumps, while, do, for. At which point there is honestly very little left. (And you still break tail...

`if (x) defer close(x)` can be written as `defer if (x) close(x)`