comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Negative float problem
Date: 27 Oct 2005 11:47:26 -0400
Date: 2005-10-27T11:47:26-04:00	[thread overview]
Message-ID: <wccoe5bc67l.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: djqqf5$nhn$1@sunnews.cern.ch

Maciej Sobczak <no.spam@no.spam.com> writes:

> Robert A Duff wrote:
> 
> > The problem here is that you don't want
> > to rename anything, so using "renames" is overkill.  The thing is still
> > called "-" -- you don't want to rename it, you want to import it with
> > the same name it always had.  Ada has no such feature.
> 
> What about Argument-Dependent Lookup (C++ has it)?

What's ADL?  I'm reasonably fluent in C++, but I don't know that term.
Also, can you give an example?

My understanding is that C++ and Ada work roughly the same way,
from a bird's eye view -- there's a notion of what names are
visible where, and then there are overload resolution rules
that determine what denotes what based on argument types and so forth.

> The file1 package was "withed", which makes the type accessible. If the
> compiler is smart enough to figure out the expected type of literal,
> then it should be also smart enough to look up any operators (and why
> not other operations as well?) that are used together with the literal
> in the package from which the expected type come from. That would
> provide the "expected" functionality.

It's not particularly an issue of how smart the compiler is.
Certainly, if the rules were as you suggest, compilers could
implement them just as easily as the current rules.  In fact,
the rules you suggest are equivalent to always having a use clause,
if I understand what you mean.

As to "why not other operations as well?" -- I think it's reasonable to
require a use clause to get them.  And in many cases, it's useful to
avoid the use clause, and use Package_Name.Procedure_Name notation,
because that allows the reader to understand where Procedure_Name
comes from.

Operators are special, though.  They are deliberately meant for cases
where terseness wins over verbosity.  I think Package_Name."-"
is an abomination -- if you want to use that verbose notation,
then you shouldn't have called the thing "-" in the first
place!

Note that in C++, you will generally be referring to an object name as a
prefix, which somewhat mimics the Ada "Package_Name." idea.

> I'm really surprised that the code posted at the beginning of this
> thread does not compile.

Many people are.

>... I'm pretty sure that something like ADL was
> considered for Ada, but apparently rejected. What was the reason?

- Bob



  reply	other threads:[~2005-10-27 15:47 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-26 18:32 Negative float problem Luke
2005-10-26 19:05 ` Samuel Tardieu
2005-10-26 20:42 ` Robert A Duff
2005-10-27  8:05   ` Robert I. Eachus
2005-10-27 14:48     ` Robert A Duff
2005-10-27 15:07       ` Maciej Sobczak
2005-10-27 15:47         ` Robert A Duff [this message]
2005-10-28  8:34           ` Maciej Sobczak
2005-10-29 23:39             ` Brian May
2005-10-30  9:11             ` Dmitry A. Kazakov
2005-10-31  9:46               ` Maciej Sobczak
2005-10-31 14:20                 ` Dmitry A. Kazakov
2005-11-01 11:06                   ` Maciej Sobczak
2005-11-01 14:06                     ` Robert A Duff
2005-11-01 14:46                       ` Martin Dowie
2005-11-01 16:04                         ` Hyman Rosen
2005-11-01 17:19                           ` Martin Dowie
2005-11-02  0:13                         ` Robert A Duff
2005-11-02  6:59                           ` Martin Dowie
2005-11-02 13:24                             ` Robert A Duff
2005-11-02 15:22                               ` Martin Dowie
2005-11-01 15:12                       ` Maciej Sobczak
2005-11-02  0:28                         ` Robert A Duff
2005-11-02  4:16                           ` Steve Whalen
2005-11-14  7:26                           ` Dave Thompson
2005-11-20  0:19                             ` Robert A Duff
2005-11-20 11:07                               ` Dmitry A. Kazakov
2005-11-01 14:27                     ` Dmitry A. Kazakov
2005-11-01 15:19                       ` Maciej Sobczak
2005-11-01 19:44                         ` Dmitry A. Kazakov
2005-11-02  9:04                           ` Maciej Sobczak
2005-11-02 11:17                             ` Dmitry A. Kazakov
2005-11-02 13:03                               ` Maciej Sobczak
2005-11-02 14:20                                 ` Jean-Pierre Rosen
2005-11-02 20:15                                   ` Jeffrey R. Carter
2005-11-03 13:06                                     ` Jean-Pierre Rosen
2005-11-03 18:32                                       ` Jeffrey R. Carter
2005-11-03  9:51                                   ` Maciej Sobczak
2005-11-03 13:20                                     ` Jean-Pierre Rosen
2005-11-03 15:02                                       ` Maciej Sobczak
2005-11-03 18:55                                         ` Frank J. Lhota
2005-11-04  9:32                                           ` Maciej Sobczak
2005-11-03 20:59                                     ` Simon Wright
2005-11-02 13:32                               ` Robert A Duff
2005-11-02 14:44                                 ` Dmitry A. Kazakov
2005-11-02 13:47                               ` Dmitry A. Kazakov
2005-10-27 18:33       ` Dmitry A. Kazakov
replies disabled

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