comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: renaming Interfaces.Java.Ada_To_Java_String to the + operator
Date: 1998/01/15
Date: 1998-01-15T00:00:00+00:00	[thread overview]
Message-ID: <dewar.884923343@merv> (raw)
In-Reply-To: 01bd21ff$7f85e3a0$95fc82c1@xhv46.dial.pipex.com


Nick says

<<I have to say, however, I would still assert that something like

   File_Name_1_In_Java := To_Java_String(File_Name_1);

is better than

   File_Name_1_In_Java := +File_Name_1;

in the vast majority of cases.  I hope this example is not felt to be
unfair by those who disagree with me.

My point is this: what is truly gained by the second version?
>>


Well anyone can assert anything!

The point is that we cannot tell from your example which is clearer. The
issue is whether it is important at the appropriate level of abstraction
to emphasize that there are two types involved here. If yes, then the
top line is preferable, if no, then the bottom line is preferable, since
the "To_Java_String" is irrelevant noise.

Note that when you say 

  A := B;

you are quite happy with this even though A and B have different subtypes.

Now if in fact A is of subtype Integer range 1 .. 10 and B is of subtype
Integer, and a major function of the assignment statement is the range
check, then it would not come amiss to say

  A := Restricted_Integer_Range_Type (B);

but normally this is NOT a major semantic component of what is going on
(even though the check might be there), and we are very happy to not be
forced to write the type name for this kind of subtype conversion check.

Now in the case where two separate types are involved, the conversion
between them may or may not be significant. I can easily imagine a
situation where you are using two packages, each of which instantiates
a copy of bounded string for 100 character strings. You are stuck with
these two types because that's the way the packages came, but as far
as you are concerned it would have been better if they had been the
same type, and the type conversions are entirely artifacts and have
zero semantic significance. In such a case the + is appropriate (and
in fact a bit too noisy, since implicit conversion would be fine in
this case, but + is not too bad as an approximation of nothing :-)





  reply	other threads:[~1998-01-15  0:00 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-01-11  0:00 renaming Interfaces.Java.Ada_To_Java_String to the + operator Terry J. Westley
1998-01-10  0:00 ` Robert Dewar
1998-01-10  0:00   ` Matthew Heaney
1998-01-13  0:00     ` Tom Moran
1998-01-13  0:00       ` Stephen Leake
1998-01-13  0:00         ` Nick Roberts
1998-01-13  0:00       ` Stephen Leake
1998-01-13  0:00       ` Robert Dewar
     [not found]       ` <En3Cxz.7HD@world.std.com>
1998-01-20  0:00         ` Robert Dewar
1998-01-21  0:00           ` Stephen Leake
1998-01-22  0:00           ` Robert Dewar
1998-01-22  0:00             ` Anonymous
     [not found]               ` <dewar.885498969@merv>
1998-01-23  0:00                 ` Geert Bosch
1998-01-23  0:00                 ` Tom Moran
1998-01-23  0:00             ` Anonymous
1998-01-24  0:00             ` Tucker Taft
1998-01-11  0:00   ` Chris Morgan
1998-01-11  0:00     ` Robert Dewar
1998-01-11  0:00       ` Chris Morgan
1998-01-11  0:00         ` Robert Dewar
1998-01-11  0:00           ` Chris Morgan
1998-01-11  0:00             ` Robert Dewar
1998-01-11  0:00 ` Nick Roberts
1998-01-11  0:00   ` Robert Dewar
1998-01-14  0:00     ` Anonymous
1998-01-14  0:00       ` Robert Dewar
1998-01-11  0:00   ` Brian Rogoff
1998-01-13  0:00     ` Terry J. Westley
1998-01-14  0:00       ` Robert Dewar
1998-01-15  0:00         ` Nick Roberts
1998-01-15  0:00           ` Robert Dewar [this message]
1998-01-16  0:00           ` Michael F Brenner
1998-01-16  0:00             ` Nick Roberts
1998-01-16  0:00               ` Robert Dewar
1998-01-17  0:00                 ` miniscences Nick Roberts
1998-01-17  0:00                   ` miniscences Robert Dewar
1998-01-19  0:00                 ` renaming Interfaces.Java.Ada_To_Java_String to the + operator Anonymous
1998-01-25  0:00                   ` Matthew Heaney
1998-01-16  0:00             ` Robert Dewar
1998-01-12  0:00 ` Tucker Taft
replies disabled

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