On Monday, July 12, 2010 15:40:24 torhu wrote: > On 13.07.2010 00:09, bearophile wrote: > > Jonathan M Davis: > >> There are lots of cases where using scope(exit) makes sense, and it's a > >> great construct. But there are also plenty of cases where using plain > >> old RAII with a single declaration is better. It works fine in D as > >> long as the struct in question doesn't need a default constructor. But > >> if it does, then it becomes a problem. > > > > Can't you use a static opCall (also suggested by Jacob Carlborg)? > > > > Bye, > > bearophile > > I think that's supposed to go away, but I'm not 100% sure. Would make > sense, since it was added as a sort of stopgap measure when there were > no struct literals.
This would be why I like Berophile's suggestion on the main list of having a page which lists deprecated and intended to be deprecated constructs. opCall is a good solution and basically fulfills the requirements of a default constructor, but if it's going away, then it's in the same camp as using scope on a class. - Jonathan M Davis