Uh... destructors?

Steven Schveighoffer schveiguy at yahoo.com
Thu Feb 24 16:59:52 PST 2011


On Thu, 24 Feb 2011 19:25:24 -0500, Steven Wawryk <stevenw at acres.com.au>  
wrote:

> On 24/02/11 14:47, dsimcha wrote:
>> On 2/22/2011 12:13 AM, Jonathan M Davis wrote:
>>> On Monday 21 February 2011 20:46:56 %u wrote:
>>>> Hi,
>>>>
>>>> I'm just curious... why is saying something like this:
>>>>
>>>> extern(C)
>>>> private static const pure override final synchronized ~this() { }
>>>>
>>>> allowed?
>>>
>>> dmd is pretty lax about attributes which don't apply. It generally
>>> just ignores
>>> them. Personally, I think that it should error on invalid attributes,
>>> but for
>>> some reason, that's not how it works. Of course, there could be other
>>> bugs in
>>> play here, but there's every possibility that the end result is
>>> completely
>>> valid.
>>>
>>> - Jonathan M Davis
>>
>> One point noone's apparently made yet: DMD's ignorance here is
>> occasionally a boon for generic programming. For example, in some places
>> in various code I write things like:
>>
>> void doStuff(C)(scope C callable)
>>
>> In this case, C can be either a delegate, a function pointer, or a class
>> or struct that overloads opCall. Scope structs and function pointers
>> make no sense. Scope delegates mean that the delegate does not escape
>> the scope of doStuff(), so no closure allocation is needed. If I had to
>> write two separate functions to handle cases like these it would be a
>> **huge** PITA.
>
> Aren't scope parameters deprecated and going to disappear from under  
> your feet?
>

No, just scope classes.

-Steve


More information about the Digitalmars-d mailing list