Andrew Lentvorski wrote:

> Christopher Smith wrote:
>
>> Finalizers are not destructors, and arguably actually have more problems
>> than destructors.
>
>
> You are correct in that finalizers are not destructors.  Them having
> more problems than C++ destructors is just patently not true.

C++ destructors, as you pointed out, have issues with exceptions, such
that they aren't a reliable mechanism for error handling when freeing
resources. Finalizers also have issues with exceptions such that they
aren't a reliable mechanism for error handling when freeing resources.
Finalizers also have issues with potentially needing to be invoked
repeatedly, objects becoming part of the active set *after*
finalization, not being reliably invoked, etc. They just aren't a useful
mechanism for enforcing any kind of useful resource management policy.

>>>> 4) multiple inheritence
>>>
>>> Java does provide for it. It is awkward to implement, but can be done
>>> through the use of interfaces and mixin classes. It is also very rarely
>>> needed.
>>
>>
>> It's rarely *used*, not rarely *needed*. The hacks for doing mixins in
>> Java (even with generics) don't allow you to do policy based design.
>> Thank you, type erasure.
>
>
> At this point, you are treading into different territory.

No. This is the exact territory I started with. This is exactly what I
meant when I said "These features can be combined for a very efficient
declarative approach to resource management."

>   You really want *strongly-typed, but not statically-typed*.

Well, it falls apart without strong typing, but having it being
statically typed really doesn't get in the way, and allows for
verification of policies and contracts at compile time, which is a nice
touch.

> You really should be stepping out of the C/C++, Java, and C# language
> space into something different.

It's hard to find another language with this unique combination of
features, although I've found a few more functional-style languages that
provide other means for achieving similar goals, although I haven't yet
found one without some shortcomings for implementing policy-based
resource management.

--Chris

-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to