comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison<dennison@telepath.com>
Subject: Re: Small question concerning use
Date: Wed, 17 Oct 2001 14:21:41 GMT
Date: 2001-10-17T14:21:41+00:00	[thread overview]
Message-ID: <Vtgz7.32716$ev2.39412@www.newsranger.com> (raw)
In-Reply-To: 9qi8ls$a2g1@news.cis.okstate.edu

In article <9qi8ls$a2g1@news.cis.okstate.edu>, David Starner says...
>
>On Tue, 16 Oct 2001 20:26:16 GMT, Ted Dennison <dennison@telepath.com> wrote:
>> The best thing to do here is to take it as a constant reminder to yourself to
>> pick better names for your *own* packages and objects.
>
>The problem is, how? Ada.Streams.Count is un"use"able; it would conflict
>with other variables named Count (besides being just a bad name all

First off, it probably wouldn't be "Count", but rather "Element_Count" (we are
just talking about removing the redundant information here). 

Secondly, it is quite usable. The only problem is that, in the event of a clash,
you can't get at it when its enclosing package has been used, as the multiple
definitions hide each other. In this case, that's fine, as you can just specify
enough extra information to disambiguate it in this case. Your use still works
fine for all the other stuff in that package.

So in the event of a name clash, this would read "Streams.Element_Count" in a
"use"er's code, which differs from the current version a "use" user has to type
by all of two characters. One of those characters is a "." instead of a "_". The
"." version gives the reader more information about the object, so its clearly
the better version.

I think we should all be able to agree that its just plain silly to try to fight
against "use"ers removing package information from their code (which is exactly
what someone *wants* to do when they use a "use" clause) by manually duplicating
that package information in the name of every entity in the package.

>around). How do you name a variable so it doesn't conflict with other
>names when "use"d, but doesn't do too much repetition. What should

You can't, of course. That's one of the dangers you run every time you perform a
"use". You rolls your dice, you takes your chances. Its not a fatal problem. If
you were willing to type that disambiguating information when it was part of the
object's name, what's the problem with typing it when it is its enclosing
package's real name? It's just a "." vs. an "_".


---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html

No trees were killed in the sending of this message. 
However a large number of electrons were terribly inconvenienced.



  parent reply	other threads:[~2001-10-17 14:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-15 22:28 Small question concerning use Eric Merritt
2001-10-16  6:34 ` Rename is much better Petter Fryklund
2001-10-16 12:28 ` Small question concerning use Marc A. Criley
2001-10-16 13:27 ` Ted Dennison
2001-10-16 19:31   ` Darren New
2001-10-16 20:26     ` Ted Dennison
2001-10-16 21:26       ` David Starner
2001-10-17  0:18         ` tmoran
2001-10-17  2:48           ` Darren New
2001-10-17 10:52             ` Larry Kilgallen
2001-10-17 13:48             ` Ted Dennison
2001-10-17 14:21         ` Ted Dennison [this message]
2001-10-16 20:35     ` Ted Dennison
2001-10-16 13:54 ` Marin David Condic
2001-10-18 18:46 ` Dr. Michael Paus
replies disabled

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