comp.lang.ada
 help / color / mirror / Atom feed
From: John McCabe <john@nospam.assen.demon.co.uk>
Subject: Re: Enumeration literal visibility and use type
Date: 1998/05/27
Date: 1998-05-27T00:00:00+00:00	[thread overview]
Message-ID: <6kgqp5$fn2@gcsin3.geccs.gecm.com> (raw)
In-Reply-To: 356C45DE.5BF3@praxis-cs.co.uk


Peter Amey <pna@praxis-cs.co.uk> wrote:

>Not if suitable names are chosen.  Most of the difficulties with Ada 
>prefixes and dotted names seem to arise because people fight the 
>language rather than taking advantage of it.  Names should be chosen for 
>their readability in context.  I much prefer:
>
>package Valve is
>  type T is (Open, Shut);
>end Valve;
>
>allowing:   DrainValve : Valve.T := Valve.Shut;
>

That's not a bad point, but if I say:

   ValveState : Valve.T := Valve.Shut;

then do some processing then I want to check the state of the valve I 
have to do:

   if (ValveState = Valve.Shut) then ...

when I would rather just say:

   if (ValveState = Shut) then ...

I see the second one as being clearer.

Since "Valve" is alonger word than "Shut" and is the first to be read, 
there is a risk of it reducing the "obviousness" of what is intended, and 
reducing readability of the code.

-- 
Best Regards
John McCabe

=====================================================================
Any opinions expressed are mine and based on my own experience.  They
  should in no way be taken as the opinion of anyone I am currently
     working with, or of the company I am currently working for.
       If you have a problem with anything I say, SPEAK TO ME!
                (remove "nospam." to reply by e-mail)
=====================================================================






  reply	other threads:[~1998-05-27  0:00 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <6kej65$dnh$1@hermes.seas.smu.edu| <6kejt5$75u@gcsin3.geccs.gecm.com>
1998-05-26  0:00 ` Enumeration literal visibility and use type William Bralick
1998-05-26  0:00   ` Fergus Henderson
1998-05-27  0:00     ` John McCabe
1998-05-27  0:00       ` Peter Amey
1998-05-27  0:00         ` John McCabe [this message]
1998-05-27  0:00       ` Robert Dewar
1998-05-28  0:00         ` John McCabe
1998-05-28  0:00           ` Robert Dewar
1998-05-29  0:00             ` John McCabe
1998-05-28  0:00           ` Thomas Hood
1998-05-28  0:00             ` Robert Dewar
1998-05-27  0:00     ` William Bralick
1998-05-26  0:00 William Bralick
1998-05-26  0:00 ` Matthew Heaney
1998-05-27  0:00   ` John McCabe
1998-05-27  0:00   ` William Bralick
1998-05-27  0:00   ` Mats Weber
1998-05-26  0:00 ` Roger Racine
1998-05-26  0:00 ` John McCabe
1998-05-26  0:00   ` David C. Hoos, Sr.
1998-05-26  0:00     ` Matthew Heaney
1998-05-27  0:00       ` John McCabe
1998-05-26  0:00     ` Ray Blaak
1998-05-27  0:00       ` John McCabe
1998-05-27  0:00         ` John McCabe
1998-05-26  0:00     ` John English
1998-05-27  0:00     ` Robert Dewar
1998-05-27  0:00       ` Matthew Heaney
replies disabled

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