== Quote from bearophile ([email protected])'s article > One of the things the paper says about D scope guards is: "Scope guards do not provide encapsulation".
(Rolls eyes.) I feel like this is a "standard" criticism of language features that's code for "I don't like this feature". IIRC they said the same thing about delegates in Java. Without even reading the paper, there are two reasons why this is an idiotic thing to say: 1. D also provides struct destructors, which are a more encapsulated way of accomplishing the same thing. Scope guards are intended for one-off use cases where declaring a type, etc. is just extra overhead and accomplishes nothing. 2. Encapsulation is only a means, not an end in itself. Sometimes people lose sight of this. The end goal is to write correct, efficient, readable, maintainable programs. If increasing encapsulation hurts these goals instead of helping them (as excessive encapsulation as practiced by obsessive-compulsive people does), then it's a Bad Thing.
