comp.lang.ada
 help / color / mirror / Atom feed
  • * Re: constant string array
           [not found] <910u3p$v9j$1@nnrp1.deja.com>
           [not found] ` <slrn9383g6.coa.randhol+abuse@kiuk0156.chembio.ntnu.no>
    @ 2000-12-11 21:41 ` Pascal Obry
      2000-12-12  2:54   ` Robert Dewar
      2000-12-12  2:56   ` Robert Dewar
           [not found] ` <3A3445A8.8FC404D5@acm.org>
      2000-12-15 18:41 ` constant string array Freelancer
      3 siblings, 2 replies; 75+ messages in thread
    From: Pascal Obry @ 2000-12-11 21:41 UTC (permalink / raw)
    
    
    bjoern_h@my-deja.com writes:
    
    > Hi,
    > 
    > I want to store constant strings (keywords of
    > Ada) of different
    > length in an array like that:
    
    Since you have asked for constant string and nobody have proposed a solution
    without Unbounded_String here is my own way to do this:
    
    (cut & past from Ada Web Server implementation)
    
    -------------------------------------------------------------------------
    
    package body AWS.Messages is
    
       type String_Access is access constant String;
    
       subtype Status_Code_Image is String (1 .. 3);
    
       S100_Message : aliased constant String := "Continue";
       S101_Message : aliased constant String := "Switching Protocols";
       S200_Message : aliased constant String := "OK";
       S201_Message : aliased constant String := "Create";
       S202_Message : aliased constant String := "Accepted";
       S203_Message : aliased constant String := "Non-Authoritative Information";
       S204_Message : aliased constant String := "No Content";
       S205_Message : aliased constant String := "Reset Content";
       S206_Message : aliased constant String := "Partial Content";
       S300_Message : aliased constant String := "Multiple Choices";
       ...
    
       type Status_Data is record
          Code          : Status_Code_Image;
          Reason_Phrase : String_Access;
       end record;
    
       Status_Messages : array (Status_Code) of Status_Data
         := (S100 => ("100", S100_Message'Access),
             S101 => ("101", S101_Message'Access),
             S200 => ("200", S200_Message'Access),
             S201 => ("201", S201_Message'Access),
             S202 => ("202", S202_Message'Access),
             S203 => ("203", S203_Message'Access),
       ...
    
    -------------------------------------------------------------------------
    
    Pascal.
    
    -- 
    
    --|------------------------------------------------------
    --| Pascal Obry                           Team-Ada Member
    --| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
    --|------------------------------------------------------
    --|         http://perso.wanadoo.fr/pascal.obry
    --|
    --| "The best way to travel is by means of imagination"
    
    
    
    ^ permalink raw reply	[flat|nested] 75+ messages in thread
  • [parent not found: <3A3445A8.8FC404D5@acm.org>]
  • * Re: constant string array
           [not found] <910u3p$v9j$1@nnrp1.deja.com>
                       ` (2 preceding siblings ...)
           [not found] ` <3A3445A8.8FC404D5@acm.org>
    @ 2000-12-15 18:41 ` Freelancer
      3 siblings, 0 replies; 75+ messages in thread
    From: Freelancer @ 2000-12-15 18:41 UTC (permalink / raw)
    
    
    
    We went from constant string array to a debate on parens.
    
    Interesting.
    
    The use of unnecessary parens is a biohazard to everyone!!
    (Kill the junk) or else (its putrid state will gather foul bacteria in thy
    nose!)
    
    
    Personally I think that a good comment should precede a complicated
    statement. That should be enough for the reader. The rest is more of a
    preference varying from one programmer to the other. So the reader should
    have the ability to adapt himself. (Always to a certain extent)...
    
    
    What's your extent?
    
    
    
    
    
    
    ^ permalink raw reply	[flat|nested] 75+ messages in thread
  • * RE: Bad coding standards
    @ 2000-12-13 22:23 Beard, Frank
      2000-12-13 23:56 ` Ken Garlington
                       ` (2 more replies)
      0 siblings, 3 replies; 75+ messages in thread
    From: Beard, Frank @ 2000-12-13 22:23 UTC (permalink / raw)
      To: 'comp.lang.ada@ada.eu.org'
    
    (was Re: constant string array)
    
    
    Ken Garlington wrote:
    
    > I say, why stop at one set? I think a nice rule would be to encode tests
    in
    > double parentheses, similar to label constructs, i.e.
    > 
    > if ((a * b + c)) then
    >   ...
    > end if;
    > 
    > so that, if you're doing structural test coverage analysis, you can find
    the
    > essential elements easily. Wouldn't that just be a lovely standard?
    
    Well, I suppose they had to stop somewhere, as all standards do.
    
    Assuming you're being facetious, I assume no-one is under the
    delusion that everyone out there in the Ada world, or even
    everyone on CLA, uses the same style guide, or even likes
    everything about the coding standards they're using.  After
    all, style guides are subjective.  It's not science.  If it
    were, there would probably be only one style guide (maybe two).
    But instead it is subject to preference.  Using upper case
    or lower case has no bearing on how the code runs.
    Unless your talking about style guide issues that specify
    using "for loops" as opposed to a "slices", or using "case"
    statements instead of an "if" statements, then it has no
    impact on the operation or performance of the software, just
    aesthetics.
    
    Is there supposed to be an "official" style guide all Ada
    developers are to be using (the implied LRM standard, Ada
    Quality and Style, ...)?
    
    All I was saying in the very beginning was I wasn't willing
    to fight over the paren issue in conditional statements, but
    when they said you couldn't use "use" and you also couldn't
    use "renames", we went to war.  There was no way I was going
    to use full path names on the operators.  Fortunately, no-one
    seems to object to "use type".
    
    Fortunately, none of coding standards I've used have been as
    bad as the one's Marc described.
    
    Frank
    
    
    
    
    ^ permalink raw reply	[flat|nested] 75+ messages in thread
    * RE: Bad coding standards
    @ 2000-12-14  2:32 Beard, Frank
      2000-12-14 12:19 ` Robert Dewar
                       ` (2 more replies)
      0 siblings, 3 replies; 75+ messages in thread
    From: Beard, Frank @ 2000-12-14  2:32 UTC (permalink / raw)
      To: 'comp.lang.ada@ada.eu.org'
    
    I'm not saying coding standards/style guides are just
    aesthetics.  Listen to me now.  I'm saying that "outside"
    of coding standards that specify "which constructs to use"
    for given situations, you are now in the realm of aesthetics.
    
    I'm saying that:
    
        if success then
    
    runs no differently that
    
        if SUCCESS then
    or
        IF SUCCESS THEN
    
    It has no structural or runtime impact whatsoever.  
    If you're talking about something like using a slice
    from an array as opposed to a "for loop", then it
    can have a structural and runtime impact.  On VAX
    Ada it was faster to use a "for loop" than to use
    a slice because of the way they did range checking
    on the elements of the array.
    
    Readability (aesthetics) is a different issue.  And
    I'm not saying readability is only aesthetics. To
    quote my American Heritage Dictionary:
    
    aesthetic - "In accordance with accepted notions of
    good taste or style".
    
    I may be taking some liberties with what they mean
    by style, but to say something is more readable, to
    me usually means it is more aesthetically pleasing.
    If it's not readable, it's not aesthetically pleasing.
    I don't care how artistic you make it.
    
    Nothing in ARM paragraphs 7-8 contradicts what I said.  I 
    agree with the paragraphs.  I agree with the principle of
    readability and maintainability, but readability is subject
    to interpretation, preference, what is pleasing to read
    (dare I say it again - aesthetics), etc.
    
    Our style guide is very similar to the Ada LRM (you say
    ARM I say LRM. Which is more readably?  Neither, their
    both cryptic.).  Why don't you type out Ada Reference Manual?
    Doesn't ARM violate your style guide?  Hmmm, another exception
    (ARM renames Ada_Reference_Manual).  Why did the Ada95 LRM
    style change from the Ada83 LRM style?  Hmmm, yet another
    exception.  Is suddenly the Ada83 LRM style "bad"?  Oh,
    the poor souls who got trapped under the Ada83 style.
    Have they yet to see the salvation of the Ada95 style?
    Will Ada0x change yet again?  Who's right, who's wrong?
    Why doesn't the Ada standard specify the style as well,
    so that we're all writing to the same coding standard,
    if it is that crucial and people have such poignant
    opinions about it?
    
    Frank
    
    
    
    -----Original Message-----
    From: Ken Garlington [mailto:Ken.Garlington@computer.org]
    :
    : Ouch! "Just aesthetics?" See ARM, Introduction, paragraphs 7-8 for a
    : contrary position.
    :
    :
    
    
    _______________________________________________
    comp.lang.ada mailing list
    comp.lang.ada@ada.eu.org
    http://ada.eu.org/mailman/listinfo/comp.lang.ada
    
    
    
    
    ^ permalink raw reply	[flat|nested] 75+ messages in thread
    * RE: Bad coding standards
    @ 2000-12-15  5:00 Beard, Frank
      2000-12-15 14:14 ` Ken Garlington
                       ` (2 more replies)
      0 siblings, 3 replies; 75+ messages in thread
    From: Beard, Frank @ 2000-12-15  5:00 UTC (permalink / raw)
      To: 'comp.lang.ada@ada.eu.org'
    
    -----Original Message-----
    From: Ken Garlington [mailto:Ken.Garlington@computer.org]
    
    > Because (a) that's not what it's intended to do, and (b) there are other
    > document that *are* intended for that purpose. Since Ada attempts to
    > discourage the "copy principle," it's not surprising that the ARM does not
    > choose to be redundant with available style guides ;)
    
    Why not?   Seeing how the Ada Reference Manual is the "bible" of the Ada
    language, written by the founders (or "pillars") of the language.  Wouldn't
    it be reasonable to assume that the examples given in the reference
    manual would be written in a "good" style?  And as such, worthy of
    emulation,
    something to be followed?  You know, a reasonable guide.  What's that
    phrase?
    Oh yeah, a "style guide".
    
    Because I think it's ludicrous to assume those using the language manual,
    especially new users, wouldn't assume that the "examples" weren't a
    good style to follow.  I know later they could learn about style guides,
    but if it were another part of the standard, maybe the "Style Guide
    Annex", then we would have universal approach.  Why not?  Many in the 
    beginning didn't think we could get this many people, from different
    countries, to agree, within reason, on a programming language.
    
    I'm not sure about the "Since Ada attempts to discourage the "copy
    principle,""
    part.  I'm not sure where that comes from.  But, it seems to me reuse is the
    ultimate in the "copy principle" (more like condoned plagiarism), and the
    main point of the style guides (and by that I mean the style guide says this
    is what we think is "good", do it this way).
    
    
    >>   "it has no impact on the operation or performance of the software, just
    >> aesthetics."
    >
    > I might assume that the word "just" implies that aesthetics are less
    > important than operation or performance. As the ARM points out, the design
    > of Ada is predicated in part on the idea that aesthetics are very
    important.
    
    Well, I can see where that could possibly happen.  Maybe I should
    have said "just the aesthetics".  If you look at the whole sentence:
    
    "Unless your talking about style guide issues that specify
    using "for loops" as opposed to a "slices", or using "case"
    statements instead of an "if" statements, then it has no
    impact on the operation or performance of the software, just
    aesthetics."
    
    The "just" in the sentence meant that outside the part of style
    guide that deals with structural issues, such as data structures,
    then your are left with just the aesthetic part.  I didn't mean
    to imply that I didn't think aesthetics were important, just
    subject to opinion.  If you didn't get my point in previous e-mails,
    I consider it an integral part of readability.  Unlike some who
    think readability and aesthetics form some type of dichotomy, or
    at least don't see the connection.
    
    Frank
    
    
    
    
    
    
    ^ permalink raw reply	[flat|nested] 75+ messages in thread
    * RE: Bad coding standards
    @ 2000-12-19 17:46 Beard, Frank
      0 siblings, 0 replies; 75+ messages in thread
    From: Beard, Frank @ 2000-12-19 17:46 UTC (permalink / raw)
      To: 'comp.lang.ada@ada.eu.org'
    
    
    -----Original Message-----
    From: Robert Dewar [mailto:robert_dewar@my-deja.com]
    
    > So my recommendation is follow the RM style for keyword and
    > identifier capitalization unless there is good reason not to.
    
    But this was exactly my point for using the RM as a style guide.
    "Style" being the optimal word.  Of course you can't use the RM
    for content issues, such as choice of data structure, because the
    RM can't guess what type of platform, or type of application, 
    you're working with.  I assumed this was a given, but considering
    the diversity of the list I guess I shouldn't make these kinds of
    assumptions.
    
    Frank
    
    
    
    
    ^ permalink raw reply	[flat|nested] 75+ messages in thread

    end of thread, other threads:[~2001-01-06 19:45 UTC | newest]
    
    Thread overview: 75+ messages (download: mbox.gz / follow: Atom feed)
    -- links below jump to the message on this page --
         [not found] <910u3p$v9j$1@nnrp1.deja.com>
         [not found] ` <slrn9383g6.coa.randhol+abuse@kiuk0156.chembio.ntnu.no>
         [not found]   ` <9138e5$o6a$1@nnrp1.deja.com>
    2000-12-11 19:34     ` constant string array Robert Dewar
    2000-12-11 21:41 ` Pascal Obry
    2000-12-12  2:54   ` Robert Dewar
    2000-12-12  2:56   ` Robert Dewar
         [not found] ` <3A3445A8.8FC404D5@acm.org>
         [not found]   ` <912ut9$fga$1@nnrp1.deja.com>
         [not found]     ` <9132ng$j10$1@nnrp1.deja.com>
    2000-12-11 19:39       ` Robert Dewar
    2000-12-12  2:31     ` Ken Garlington
    2000-12-12  2:53       ` Robert Dewar
    2000-12-12  4:39         ` Ken Garlington
    2000-12-12  4:56     ` Jeff Carter
    2000-12-12 20:57       ` Beard, Frank
    2000-12-12 23:05         ` Jeff Carter
    2000-12-13  0:37           ` Robert Dewar
    2000-12-13  0:36         ` Robert Dewar
    2000-12-13  0:39         ` Robert Dewar
    2000-12-13  2:02           ` Beard, Frank
    2000-12-13  2:33             ` Robert Dewar
    2000-12-13  2:55               ` Beard, Frank
    2000-12-13  4:00                 ` Ken Garlington
    2000-12-13 13:38                   ` Bad coding standards Marc A. Criley
    2000-12-13 13:54                     ` Ken Garlington
    2000-12-13 20:55                     ` David Emery
    2000-12-14 13:07                       ` Robert Dewar
    2000-12-14 14:21                         ` Ken Garlington
    2000-12-15  0:08                           ` Wayne Magor
    2000-12-15  1:40                             ` Ken Garlington
    2000-12-15  3:18                         ` DuckE
    2000-12-15  4:45                           ` Ed Falis
    2000-12-15 15:44                           ` Robert C. Leif, Ph.D.
    2000-12-15 16:34                             ` Ted Dennison
    2000-12-16  6:08                               ` Robert C. Leif, Ph.D.
    2000-12-16  1:16                             ` Robert Dewar
    2000-12-16  1:19                             ` Robert Dewar
    2000-12-17  5:49                               ` Robert C. Leif, Ph.D.
    2000-12-17  8:24                                 ` Robert Dewar
    2000-12-15 15:56                       ` Charles H. Sampson
    2000-12-15 20:43                         ` Wayne Lydecker
    2000-12-16  4:31                           ` Ken Garlington
    2000-12-16 11:36                           ` Robert Dewar
    2000-12-15 21:36                         ` tmoran
    2000-12-15 18:41 ` constant string array Freelancer
    2000-12-13 22:23 Bad coding standards Beard, Frank
    2000-12-13 23:56 ` Ken Garlington
    2000-12-14  0:37   ` Ken Garlington
    2000-12-14  4:08 ` Robert Dewar
    2000-12-14 14:06   ` Ken Garlington
    2000-12-14 20:15     ` Robert Dewar
    2000-12-15  5:55 ` Keith 
      -- strict thread matches above, loose matches on Subject: below --
    2000-12-14  2:32 Beard, Frank
    2000-12-14 12:19 ` Robert Dewar
    2000-12-14 14:03 ` Ken Garlington
    2000-12-14 20:14   ` Robert Dewar
    2000-12-15  1:10     ` Ken Garlington
    2000-12-18 16:09     ` Tucker Taft
    2000-12-18 18:59       ` Marin David Condic
    2000-12-18 22:20         ` Georg Bauhaus
    2000-12-19 15:51           ` Tucker Taft
    2000-12-19 16:12             ` Marin David Condic
    2000-12-19 16:01           ` Robert Dewar
    2000-12-19 15:49         ` Robert Dewar
    2000-12-19 16:36           ` Marin David Condic
    2000-12-20  1:52             ` Ken Garlington
    2000-12-20 12:58               ` Marin David Condic
    2000-12-20 14:27                 ` Ken Garlington
    2000-12-21 23:19                   ` Marin David Condic
    2001-01-03 19:49                     ` Wes Groleau
    2001-01-06 19:45                       ` Lao Xiao Hai
    2000-12-20 11:56             ` Mario Amado Alves
    2000-12-19 18:05           ` Larry Kilgallen
    2000-12-19 15:42       ` Robert Dewar
    2000-12-15  0:52 ` Georg Bauhaus
    2000-12-15  5:00 Beard, Frank
    2000-12-15 14:14 ` Ken Garlington
    2000-12-16  1:28 ` Robert Dewar
    2000-12-18 20:00 ` Robert L. Spooner
    2000-12-19 17:46 Beard, Frank
    

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