POV-Ray : Newsgroups : povray.off-topic : C++ templates to get Java-style interfaces... Server Time
11 Oct 2024 13:14:28 EDT (-0400)
  C++ templates to get Java-style interfaces... (Message 11 to 15 of 15)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Darren New
Subject: Re: C++ templates to get Java-style interfaces...
Date: 22 Oct 2007 00:10:31
Message: <471c22b7@news.povray.org>
Warp wrote:
> Darren New <dne### [at] sanrrcom> wrote:
>> It just doesn't give you the same benefits that doing it with 
>> Java does, due to the nature of the compilation process and object code 
>> storage formats.
> 
>   What benefits are those?

Strongly typed separate compilation units, and strongly typed dynamic 
loading, for two.

-- 
   Darren New / San Diego, CA, USA (PST)
     Remember the good old days, when we
     used to complain about cryptography
     being export-restricted?


Post a reply to this message

From: Warp
Subject: Re: C++ templates to get Java-style interfaces...
Date: 22 Oct 2007 05:39:58
Message: <471c6fee@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> Warp wrote:
> > Darren New <dne### [at] sanrrcom> wrote:
> >> It just doesn't give you the same benefits that doing it with 
> >> Java does, due to the nature of the compilation process and object code 
> >> storage formats.
> > 
> >   What benefits are those?

> Strongly typed separate compilation units, and strongly typed dynamic 
> loading, for two.

  I don't understand what that means.

-- 
                                                          - Warp


Post a reply to this message

From: Darren New
Subject: Re: C++ templates to get Java-style interfaces...
Date: 22 Oct 2007 10:32:20
Message: <471cb474$1@news.povray.org>
Warp wrote:
> Darren New <dne### [at] sanrrcom> wrote:
>> Warp wrote:
>>> Darren New <dne### [at] sanrrcom> wrote:
>>>> It just doesn't give you the same benefits that doing it with 
>>>> Java does, due to the nature of the compilation process and object code 
>>>> storage formats.
>>>   What benefits are those?
> 
>> Strongly typed separate compilation units, and strongly typed dynamic 
>> loading, for two.
> 
>   I don't understand what that means.

Sure. Give me the .o file that corresponds to your template. (And before 
you explain that isn't how templates work, yes, I know. That's the point.)

Then compile three different C++ classes that have + and * and a fourth 
that doesn't into DLL files, and let me pass them into *my* template 
that requires + and * and make sure all four give me a well-defined result.

You *could* do that with code and data-allocation included, but it would 
be a lot more difficult.

-- 
   Darren New / San Diego, CA, USA (PST)
     Remember the good old days, when we
     used to complain about cryptography
     being export-restricted?


Post a reply to this message

From: Warp
Subject: Re: C++ templates to get Java-style interfaces...
Date: 22 Oct 2007 10:35:06
Message: <471cb519@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> Warp wrote:
> > Darren New <dne### [at] sanrrcom> wrote:
> >> Warp wrote:
> >>> Darren New <dne### [at] sanrrcom> wrote:
> >>>> It just doesn't give you the same benefits that doing it with 
> >>>> Java does, due to the nature of the compilation process and object code 
> >>>> storage formats.
> >>>   What benefits are those?
> > 
> >> Strongly typed separate compilation units, and strongly typed dynamic 
> >> loading, for two.
> > 
> >   I don't understand what that means.

> Sure. Give me the .o file that corresponds to your template. (And before 
> you explain that isn't how templates work, yes, I know. That's the point.)

  Uh, I was comparing Java interfaces with C++ classes with only pure
virtual functions and no member variables. That's exactly what I asked:
What is the difference between these two things? You responded with what
I quoted first above.

-- 
                                                          - Warp


Post a reply to this message

From: Darren New
Subject: Re: C++ templates to get Java-style interfaces...
Date: 22 Oct 2007 10:51:20
Message: <471cb8e8$1@news.povray.org>
Warp wrote:
>   Uh, I was comparing Java interfaces with C++ classes with only pure
> virtual functions and no member variables. That's exactly what I asked:

Oh. I was referring to the benefits of
"""
I'll also note there's a bunch of benefits to doing it the way Java does 
that C++ templates can't support
"""

I hadn't realized you'd changed subjects.

> What is the difference between these two things? You responded with what
> I quoted first above.

Pretty much the same benefits. Separate compilation with strong typing, 
and dynamic loading with strong typing. Again, there's nothing really 
*stopping* a C++ compiler from doing strong typing for compilation and 
dynamic loading - it just isn't part of the language. (I.e., in the same 
way that nothing stops C++ from having threads, but it isn't part of the 
language you can count on.)

-- 
   Darren New / San Diego, CA, USA (PST)
     Remember the good old days, when we
     used to complain about cryptography
     being export-restricted?


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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