Beginning C++ in FreeBSD

Danny MacMillan flowers at users.sourceforge.net
Wed Apr 21 21:01:38 PDT 2004


On Wed, 21 Apr 2004 11:05:48 -0700, Chris Pressey 
<cpressey at catseye.mine.nu> wrote:

> On Tue, 20 Apr 2004 23:28:48 -0600
> Dan MacMillan <flowers at users.sourceforge.net> wrote:
>
>> These are not analagous.  The reason things get lost in the
>> translation of human language is that it is not possible to represent
>> every expression in one human language with complete precision in
>> another.
>
> I challenge you to defend this (Sapir-Worfian) claim with a specific
> example.  :)

Thirty seconds on babelfish will provide more than enough substantiation, 
and Daniela herself argued my point in one of her prior messages.  In 
crappy, somewhat whimsical pseudocode:

the_message != 
translateFrenchToEnglish( translateEnglishToFrench( the_message ) )

The translations are not reciprocal.  Though I guess that's not a specific 
example.

Note that only machine translation is relevant for the sake of this 
argument, because the information available to a human making a 
translation is basically unbounded and the process is highly subjective.

I do have to confess to some ignorance.  I don't know what your 
'Sapir-Worfian' parenthetical alludes to.  At first I thought it was a 
Star Trek reference ... but a quick Google shows that "One of the premises 
of Sapir-Worfian hypothesis implies that semantic systems vary without 
constraint".  Excellent!  I'll just hop on my double-jimsen saddle and 
check the specs on the inline for the rotary girder.

Ah, here we go.  A further Google shows that my ignorance needs no 
confession, as my reply makes it quite plain.  You've obviously given this 
at least as much thought as I have and studied it besides.  <thpthpthpth>

>> However, it =is= possible to represent object orientation
>> with complete precision in a procedural language.  To support object
>> orientation, C++ adds to C an intrinsic this pointer and vtables.
>> These concepts can be expressed explicitly in C without loss of
>> fidelity.
>
> That (the Turing-Church thesis) is not at issue.  What is at issue is
> opportunities for optimization.
>
> I can't say for "Object Orientation" specifically (since there are as
> many definitions of an "OO language" as there are "OO languages",) but
> in general, translation between languages *can* result in a loss of
> opportunities for optimization.

I agree.  That's why I asked for a specific example -- because I can't 
think of an optimization that is possible when compiling C++ code directly 
to binary that isn't possible when first translating C++ to C, then 
compiling that to binary.  Doing so will obviously take advantage of any C 
language optimizations, and I can even imagine that there are 
opportunities for optimization in the decisions the compiler would make 
translating C++ to C.

But are there lost opportunities?  I'm dubious.  I don't think there are.  
Of course, I could be wrong.  I'm not that smart.  That's why I asked for 
an example!  There are few things I enjoy more (or experience less :) than 
finding out I'm in error.

By the way, I'm thinking specifically of C vs C++ -- actually, C vs that 
subset of C++ needed for the object-oriented features.  It's the closest 
apples-to-apples comparison I can think of between non-OO and OO 
languages, and is the comparison strongly implied by Daniela's message.

> For example, if you translate a program from a language with
> partially-specified evaluation order to one with strict &
> fully-specified evaluation order, do you not lose the opportunity to
> optimize it by reordering evaluations?

Yes, and I take your point.  But the specific claim that was made was that 
object-oriented languages are optimized differently from 
non-object-oriented ones.  I just don't see it -- but again, I would enjoy 
an education.

-Danny


More information about the freebsd-chat mailing list