Deep nesting vs early returns

Rémy Mouëza remy.moueza at gmail.com
Fri Oct 5 20:06:39 UTC 2018


On Tuesday, 2 October 2018 at 18:14:55 UTC, Andrei Alexandrescu 
wrote:
> Kate Gregory makes a good argument on something I've often 
> commented in code reviews: https://youtu.be/n0Ak6xtVXno?t=2682

I've found a good explanation for the reason behind nesting here:
https://softwareengineering.stackexchange.com/a/118793

The "single entry, single exit" principle seems to predate 
structured programming. It was a best practice of a time when 
gotos and other jumps were preventing the call stack to be 
properly cleaned up or local variables to be initialized thus 
leading to  difficult to debug errors.



More information about the Digitalmars-d mailing list