On 09.03.2011 23:15, bearophile wrote:
Despite D is currently not widely used, it's not hard for me to find references 
about D into computer science papers I find around.

This paper is titles "Code Sandwiches", by Matt Elder, Steve Jackson, and Ben 
Liblit, it discusses D scope guards too (page 7 and several successive pages):
http://pages.cs.wisc.edu/~liblit/tr-1647/

One of the things the paper says about D scope guards is: "Scope guards do not 
provide encapsulation".

Indeed, they are not related to encapsulation directly. What they do provide is a convenient way to write exception safe code, with less fuss and bugs. It's a practical "shortcut" feature meant to be used inside of encapsulated entity, not to create or support one.
Bye,
bearophile

--
Dmitry Olshansky

Reply via email to