POV-Ray : Newsgroups : povray.off-topic : Generics annoyance : Re: Generics annoyance Server Time
4 Sep 2024 13:18:14 EDT (-0400)
  Re: Generics annoyance  
From: Darren New
Date: 14 Apr 2010 12:49:45
Message: <4bc5f229$1@news.povray.org>
Warp wrote:
>   I really can't understand what would be the problem in supporting
> full-fledged multiple inheritance.

Complexity, perhaps.

Also, remember the CIL is designed to support multiple languages. Granted, 
you're going to have trouble accessing objects from COBOL, but it's likely 
that MI would just make it that much more difficult. There's already kludgey 
work-arounds for (e.g.) getting to properties and indexers from languages 
that don't have properties.

>   If your answer contains the term "diamond inheritance", then forbid
> diamond inheritance, not multiple inheritance.

Impossible if everything inherits from Object. :-)

>   (Could this be, perhaps, related to garbage collection? It makes GC a lot
> more complicated if references don't always point to the beginning of the
> allocated memory block?)

That's certainly part of it, but you don't need to support multiple 
inheritance in the same way C++ does it.  Eiffel has multiple inheritance, 
garbage collection, and O(1) virtual dispatch.  (That last would probably be 
quite difficult if you didn't compile everything at the same time, of course.)

C# allows you to inherit from multiple interfaces that define the same 
method names and distinguish between them at compile time and runtime. 
(I.e., you can already have a Dog::Run interface and a Thread::Run interface 
and invoke them that way and have different implementations.) So it's not 
just a problem with the metadata and naming. (Eiffel has a different 
solution to this problem.)

Some of the rules of the language are based on superclasses. If you throw an 
object, it has to descend from Exceptions. A class with value semantics has 
to descend from "Values" or something like that. A delegate (like an OO 
function pointer) has to descend from Delegate. Etc. Maybe that's part of 
the problem.

But really, I don't think there are any obvious technical problems that 
couldn't be solved with enough work.

-- 
Darren New, San Diego CA, USA (PST)
   Yes, we're traveling together,
   but to different destinations.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.