From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,8143b93889fe9472 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.180.102.69 with SMTP id fm5mr74180wib.0.1359537520407; Wed, 30 Jan 2013 01:18:40 -0800 (PST) Path: i11ni27804wiw.0!nntp.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Ada standard and maximum line lengths Date: Wed, 30 Jan 2013 11:18:38 +0200 Organization: Tidorum Ltd Message-ID: References: <8dfcf819-e1d0-4578-a795-a4bf724b5014@googlegroups.com> <5107b329$0$6556$9b4e6d93@newsspool4.arcor-online.net> <5107eaed$0$6566$9b4e6d93@newsspool4.arcor-online.net> <51080c38$0$6561$9b4e6d93@newsspool4.arcor-online.net> <51085776$0$6637$9b4e6d93@newsspool2.arcor-online.net> Mime-Version: 1.0 X-Trace: individual.net DcsIJbfq7J2PIqZcpLjTiwSrSYOH8qrvIsP65b+OlUBMEUW4im3+vGA8kgVCv3O2hd Cancel-Lock: sha1:CiixnGJBemR3RkTjNeoOUtWAB+4= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 In-Reply-To: <51085776$0$6637$9b4e6d93@newsspool2.arcor-online.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Date: 2013-01-30T11:18:38+02:00 List-Id: On 13-01-30 01:12 , Georg Bauhaus wrote: > 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 agree that one often wants Ada bindings to other-language libraries to use the same, or similar, identifiers. But these are *identifiers*, not linker symbols. Are there some 200-character *identifiers* in the Win32 API? I doubt it. > The issue is present both ways. Say, I export this to C++: Sure. But since languages are different, it is often impossible to use the same identifier. For example, Cobol allows identifiers with hyphens, Calculate-Average-Salary, IIRC. C++ has namespaces, which can be used to emulate Ada package scopes. A harsher example would be exporting Ada subprograms for calling from a C program. Typically, large C programs use abbreviated prefixes in identifiers to simulate Ada packages or C++ namespaces. > 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. I agree, in principle. In practice, there is probably not enough language mixing going on, at least not mixing that requires portablity, to make the effort motivated. > 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). What "upper bound" of 79? I've certainly compiled longer lines, even with very early versions of GNAT. Is that limit in the GNAT style rules? > A unicode character's name is not a linker symbol, but still it > is a name from a "library" of characters that is "imported". OK. Perhaps the Unicode character names should be organized into packages rather than a flat namespace, but that can't be done if the names must define an enumerated type. Unicode is a good example of long identifiers, though. From http://www.unicode.org/charts/charindex.html I compute that the longest is/are 73 characters, counting blanks and commas. One of these 73-character names is "Bold Italic Greek Mathematical Symbols, Sans-serif". >> 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. But only for convenience (to use similar names) and not close to 200 characters. > 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. Of course it is better if an Ada compiler accepts lines of any length, and identifiers of any length. To summarize, I think this thread started by asking why the ARM mentions maximum line length at all. The discussion has shown that: - Ada 83 did not discuss line length or lexical-element length, so compilers were in principle obliged to support any length, but perhaps many compilers had limits motivated by "capacity limits". - Ada 95 introduced the lower bounds of 200 characters on lines and lexical elements. Perhaps they were not meant to be independent, and the ACATS test require the compiler to support identifiers that are as long as the longest possible line. Therefore, in practice compilers use the same limit (if any) for both, if I understood Randy correctly. - Janus/Ada has a limit of around 250 characters on identifier length, which Randy would find "annoying" to remove. - The longest real-life identifier exhibited so far is from the Unicode character names and is 73 characters. The second question, posed by George, was: > I wonder what will be the effect on working in the > programming profession of a general limit on line > lengths that is, say, <= 100 characters: Two people (Dmitry and I) came out in defense of short lines, that is, a limit on 100 characters would not have any effect on our work. J-P. reported that code he saw, written with a line-length limit of 72 characters, was horrible to read. On the other hand, some code that I have written with an 80-char limit has been praised as easy to read, so there are other factors that affect readability. And different readers have different preferences, too. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .