On Tue, 20 Jan 2015 15:51:17 -0500 Steven Schveighoffer via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> On 1/20/15 3:39 PM, ketmar via Digitalmars-d wrote: > > > and all that mess can be avoided just by enforcing the one simple rule, > > which compiler is perfectly able to check. > > I think the current situation is fine. > > 1. There are functions that sometimes allocate. I don't want to forbid > those, or force someone to write @nogc versions. > 2. One can invoke destructors without being inside the GC. > > This seems like a good job for a lint tool. my point is that those who need to run lint doesn't do that. enforcing "@nogc" on class dtors protecting people who are relatively new to D, and used to do (maybe invisible) allocations in C++ dtors, for example. yes, this is bad practice even in C++, but it mostly works there. so they coming to D and often just doesn't know that class dtors are very special beasts. to give seasoned programmer some control it's enough to introduce `@gc` attribute. there are periodical requests for "cancelling attributes" in NG, so it's a perfect excuse to both make compiler more helpful for newcomers (yes, it's better to see error message in compile-time than to get some strange crashes in run-time), and to introduce "cancelling attrs".
signature.asc
Description: PGP signature