comp.lang.ada
 help / color / mirror / Atom feed
From: Brian Rogoff <bpr@shell5.ba.best.com>
Subject: Re: Why is it Called a Package?
Date: 2000/04/07
Date: 2000-04-07T00:00:00+00:00	[thread overview]
Message-ID: <Pine.BSF.4.21.0004071218010.28379-100000@shell5.ba.best.com> (raw)
In-Reply-To: t7k8i9bzt1.fsf@calumny.jyacc.com

On 7 Apr 2000, Hyman Rosen wrote:
> Brian Rogoff <bpr@shell5.ba.best.com> writes:
> > Yes, uder defined overloadings of [] is a semantic issue, but I wouldn't 
> > think it a good idea if () were used for functions and arrays. I don't 
> > like C++'s "()" overloading, only the "[]" one.
> 
> But C++'s overloading of () allows referential transparency in template
> code, which can then be written without regard to whether a functor
> parameter is an object or a function. That's a very good thing.

In the case of an Ada like language, I don't think C++ "functors" make 
that much sense, since Ada allows subprograms as generic formal
parameters, and I'd hope that an Ada variant would even allow subprograms
assubprogram parameters, as in Pascal. I guess you could argue that for 
returned functors this overloading would be useful but that's rarer.

Incidentally, considering the title of the thread, we should ask why its
called a "functor" in C++. Seems like an abuse of existing mathematical 
language. I much prefer "function object". 

> I could argue that [] in C++ is an extremely low-level concept which
> should be used only in libraries which need to construct higher-level
> abstractions, and that therefore allowing it to be overloaded is bad,
> because it encourages its use. Just like in Ada, high-level C++ data
> structures such as vectors should use () for indexing.

I'd argue that arrays are a kind of table and having the same notation
for indexing there makes more sense, no matter how the table is 
represented. Functions are something different, *far* more general,
so I prefer to use a different notation for them. For instance it makes
sense to equip tables with equality, but not functions. Well, even if it 
makes sense, it's really hard to check equality in the case of functions
:-)

-- Brian





  reply	other threads:[~2000-04-07  0:00 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-27  0:00 Why is it Called a Package? Gary Scott
2000-03-27  0:00 ` Nick Roberts
2000-03-27  0:00   ` Robert A Duff
2000-03-29  0:00     ` Florian Weimer
2000-03-29  0:00       ` Robert A Duff
2000-03-30  0:00         ` Geoff Bull
2000-03-30  0:00           ` Robert A Duff
2000-03-30  0:00             ` Jean-Marc Bourguet
2000-03-30  0:00               ` David Starner
2000-04-03  0:00               ` Robert A Duff
2000-04-06  0:00             ` Brian Rogoff
2000-04-07  0:00               ` Robert Dewar
2000-04-07  0:00                 ` Brian Rogoff
2000-04-07  0:00                   ` Hyman Rosen
2000-04-07  0:00                     ` Brian Rogoff [this message]
2000-04-12  0:00                 ` Comment from the trenchs Robert Brantley
2000-04-13  0:00                   ` Jeff Carter
2000-04-17  0:00                     ` Robert Brantley
2000-04-07  0:00               ` Why is it Called a Package? Robert A Duff
2000-04-07  0:00                 ` Brian Rogoff
2000-04-07  0:00                   ` Robert A Duff
2000-04-08  0:00                     ` Brian Rogoff
2000-04-07  0:00               ` Pascal Obry
2000-04-07  0:00                 ` Paul Graham
2000-04-07  0:00                 ` Samuel T. Harris
2000-04-07  0:00                   ` Stanley R. Allen
2000-04-07  0:00                   ` Richard D Riehle
2000-04-08  0:00                     ` Florian Weimer
2000-04-09  0:00                       ` Stefan Skoglund
2000-04-07  0:00                   ` Brian Rogoff
2000-04-08  0:00                     ` Robert A Duff
2000-03-28  0:00   ` Jean-Marc Bourguet
2000-03-28  0:00     ` Robert A Duff
2000-03-30  0:00     ` Alfred Hilscher
2000-03-31  0:00       ` Anders Wirzenius
2000-03-28  0:00   ` Ken Garlington
2000-03-29  0:00   ` Florian Weimer
2000-03-27  0:00 ` Larry Kilgallen
2000-03-27  0:00   ` Robert A Duff
2000-03-28  0:00     ` Gary Scott
2000-03-27  0:00 ` Ted Dennison
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox