comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: Ada standard and maximum line lengths
Date: Wed, 30 Jan 2013 00:12:53 +0100
Date: 2013-01-30T00:12:54+01:00	[thread overview]
Message-ID: <51085776$0$6637$9b4e6d93@newsspool2.arcor-online.net> (raw)
In-Reply-To: <amqnmtF3q45U1@mid.individual.net>

On 29.01.13 20:54, Niklas Holsti wrote:

Upfront, my question was about the possible effects of
enforcing shorter identifiers  on the programming
profession.  I venture to read Robert Duff's recent post
as: that is a tool/setting to put into programmers' hands
if they want it, and otherwise there should be no limits.

>> Linker symbols reappear in source text.
>
> Show an example, please, where it is necessary to write a linker symbol
> verbatim as an Ada identifier.

Sure. I'll assume that the subject of good lengths of identifiers
shouldn't be argued in a stick-to-the-letter (200) fashion.

You have mentioned old Fortran's 6 characters, so lets go crazy
and start with doubling this, twice, to 24 characters per identifier.

This is from Win32Ada:

   function CreateDialogIndirectParamW

Ouch. 26 characters. You have mentioned that 32 is uncomfortable,
so 24 certainly is more uncomfortable. Still, the Win32 bindings
show that most programmers want these foreign names to be just
like the originals. So, there is a need to not impose a lower
bound that excludes unchanged Win32 identifiers.

(I vaguely remember that there were two OS/2 bindings. One
copied the names of the C style object oriented OS/2 API.
The other binding offered packages, one for each name space
prefix found in the C style function identifiers. TTBOMK,
programmers preferred the former and found the latter confusing.)

Alternatively, if I assign an Ada identifier a foreign function
using pragma Import, and choose a shorter Ada identifier of
character content different from the string, I create an indirection
and that is always hard to trace. Understandably, there should
be as much of a 1:1 correspondence as possible. This is all the
more true the more compilers arrive at handling exceptions across
language boundaries. It is necessarily puzzling to see an exception
trace mention a name that cannot be found in the source text.
(Because a pragma Import has assigned a different, shorter name.)

The issue is present both ways. Say, I export this to C++:

    procedure A.B.C.Foo (Arg : T) is
       Flop : exception;
    begin
       ...
    end Foo;

And assume that compilers involved can handle exceptions across
language boundaries. With A, B, and C standing for identifiers
of average length, when Foo is mangled function library style,
what should the C++ side catch if Foo is "naturally" mapped to

  __adaE_A...__B...__C...__Foo?

Chances are that a limit on lengths of C++ identifiers will require
an assignment of a different exception identifier with the help
of #pragma or __attribute__. There is no standard way to address
this. *But*! There could be a standard way to address this, if
the profession is offered an incentive to move away from library
style name mangling.

Third, GNAT.

When GNAT started to support ISO/IEC 10646 ("universal characters"),
GNAT's upper bound on identifier lengths had to be lifted. Even
in the sense that line length implies identifier length: There
are names in the Unicode character database that have made the
source files exceeded GNAT's upper bound on line lengths (79).

A unicode character's name is not a linker symbol, but still it
is a name from a "library" of characters that is "imported".

> Sure, this is a poor mess and should be improved.

Yes.

> But it has nothing to do with limits on identifier length in Ada.

Yes, it does: practical naming enforces a lower bound on names,
as seen.

>> Going back to my initial question. Suppose linker symbols
>> were structured. Won't the rather technical need for allowing
>> long identifiers in Ada source text just vanish?
>
> There has never been, and is not now, such a need.

That's only formally true presuming
- the indirection tables of pragma Import do work well and
-  stick-to-the-letter interpretations of "200" and
-  "most programs".
But practically, names of imported subprograms import the risk of
hitting _any_ (project or compiler) limit on identifier lengths
when these foreign entities should not be renamed.





  reply	other threads:[~2013-01-29 23:12 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-28  5:02 Ada standard and maximum line lengths Lucretia
2013-01-28  6:01 ` J-P. Rosen
2013-01-28  6:28 ` Jeffrey Carter
2013-01-28  8:05   ` Niklas Holsti
2013-01-28 16:42     ` Jeffrey Carter
2013-01-28 20:22       ` Niklas Holsti
2013-01-28 20:46         ` J-P. Rosen
2013-01-28 21:29           ` Niklas Holsti
2013-01-29  1:42             ` Randy Brukardt
2013-01-29  6:15             ` J-P. Rosen
2013-01-29 10:25               ` Niklas Holsti
2013-01-29 11:31                 ` Georg Bauhaus
2013-01-29 12:11                   ` Simon Wright
2013-01-29 12:31                   ` Niklas Holsti
2013-01-29 12:37                     ` Niklas Holsti
2013-01-29 15:29                     ` Georg Bauhaus
2013-01-29 16:58                       ` Niklas Holsti
2013-01-29 17:51                         ` Georg Bauhaus
2013-01-29 18:18                           ` Shark8
2013-01-29 19:54                           ` Niklas Holsti
2013-01-29 23:12                             ` Georg Bauhaus [this message]
2013-01-30  9:18                               ` Niklas Holsti
2013-01-30  9:51                                 ` Simon Wright
2013-01-30 15:28                                 ` Robert A Duff
2013-01-30 23:24                                   ` Randy Brukardt
2013-01-31  2:16                                     ` Robert A Duff
2013-01-31  9:10                                       ` Stefan.Lucks
2013-01-31  9:30                                         ` Niklas Holsti
2013-01-31  9:51                                           ` Simon Wright
2013-01-31 10:56                                           ` Georg Bauhaus
2013-01-31 18:02                                         ` Jeffrey Carter
2013-01-31 23:54                                       ` Randy Brukardt
2013-02-01  9:15                                         ` Niklas Holsti
2013-02-01 23:13                                           ` Randy Brukardt
2013-02-02  1:24                                             ` Lucretia
2013-02-02 14:12                                               ` Robert A Duff
2013-02-05  2:09                                               ` Randy Brukardt
2013-01-31  9:03                                   ` Dmitry A. Kazakov
2013-01-30  9:37                               ` Simon Wright
2013-01-30 12:02                                 ` Georg Bauhaus
2013-01-29 23:47                             ` Jeffrey Carter
2013-01-30  7:24                               ` Niklas Holsti
2013-01-30 10:09                                 ` J-P. Rosen
2013-01-29 20:36                 ` Niklas Holsti
2013-01-29 21:01                   ` Robert A Duff
2013-01-29 21:14                   ` Dmitry A. Kazakov
2013-01-28  8:18 ` Dmitry A. Kazakov
2013-01-28 10:02   ` Maciej Sobczak
2013-01-28 11:57     ` Georg Bauhaus
2013-01-28 13:28       ` Niklas Holsti
2013-01-28 15:14       ` J-P. Rosen
2013-01-28 16:13       ` Dmitry A. Kazakov
2013-01-28 15:13     ` Dmitry A. Kazakov
2013-01-28 13:49 ` Robert A Duff
2013-01-29  2:09   ` Randy Brukardt
2013-01-29 18:46 ` Lucretia
2013-01-29 20:53   ` Robert A Duff
2013-01-29 21:22   ` Dmitry A. Kazakov
2013-01-30  3:22     ` Lucretia
2013-01-30  9:49       ` Dmitry A. Kazakov
2013-01-30 23:28         ` Randy Brukardt
2013-02-01  1:48       ` Shark8
2013-01-29 21:29   ` Dmitry A. Kazakov
2013-01-29 21:53   ` Adam Beneschan
replies disabled

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