POV-Ray : Newsgroups : povray.off-topic : Generics annoyance : Re: Generics annoyance Server Time
4 Sep 2024 13:21:33 EDT (-0400)
  Re: Generics annoyance  
From: Darren New
Date: 14 Apr 2010 16:45:52
Message: <4bc62980$1@news.povray.org>
Warp wrote:
> Darren New <dne### [at] sanrrcom> wrote:
>> Warp wrote:
>>> Darren New <dne### [at] sanrrcom> wrote:
>>>> 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.)
>>>   As I have mentioned before, you can cast an object pointer to an
>>> incompatible type assuming that:
> 
>> Right.  I'm not sure what that had to do with what I was saying.
> 
>   Nothing. Not everything has to be a direct answer to what has been written.
> It's chatter.

OK. Just checking. :-)

>> I believe the mechanism relies on knowing at compile time what every class 
>> in the system will be.
> 
>   You mean it doesn't support precompiled libraries? (Why does that seem to
> be so common with "higher-level" languages?)

It does, but I think you need more than just the object code in there. Kind 
of like the way C# is "precompiled" I guess. I'm not sure of the actual 
implementation details.

And it's not like C++ supports precompiled templates, either. :-)

> 
>>>   I wonder if Eiffel supports this as well.
> 
>> Eiffel lets you cast up and down the heirarchy. All methods are semantically 
>> virtual (even if the compiler optimizes them to direct jumps), so the fact 
>> that you're casting up and down doesn't make it "invalid". You can't cast a 
>> reference to an object to a type that isn't in that object's parent class 
>> heirarchy.
> 
>   Does that mean "no"?

I wasn't 100% sure what the "this" was.

>   Note that in the case I was talking about you are not casting only up or
> only down in the hierarchy. You are actually casting down and then up in one
> go (in a multiple inheritance situation), without seeing any of the
> intermediate classes directly.

Oh. Honestly, I'm not so up on Eiffel I could answer that without looking it 
up. But I would suspect not. I mean, if you have Gamma inherit from Alpha 
and Beta, and you have a variable declared as Beta and you want to assign it 
to a variable of type Alpha, while you could get Gamma to do that, I don't 
think you could compile that without first casting the Beta to a Gamma or 
something. I really don't know, honestly.

-- 
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.