comp.lang.ada
 help / color / mirror / Atom feed
* Re: Limited Use Clause
@ 1988-12-17 21:56 Erland Sommarskog
  1988-12-18 14:48 ` Dik T. Winter
  1988-12-19 14:17 ` Steve Tynor
  0 siblings, 2 replies; 14+ messages in thread
From: Erland Sommarskog @ 1988-12-17 21:56 UTC (permalink / raw)


Steve Tynor (tynor@pyr.UUCP) first said:
>>> 	with XYZ;
>>> 	use XYZ."=", XYZ."/=", XYZ.PUSH, XYZ.POP;
>>> 	package ...

I said:
>>   use XYZ."="(a, b : XYZ_type), XYZ.Push(x : some_type) ...

Then he said:
>This is going one step further than I suggested. I'm not convinced that it's
>truly necessary. I still think importing identifiers (if they're overloaded
>you get all of them) would be a useful, relatively easily implemented
>addition to the language.

Of course a matter of taste, but I think mentioning a name and getting 
all subprograms with that name is a very non-Ada way of approaching
things. In Ada a subprogram *is* identified by its name and its parameter
list.
-- 
Erland Sommarskog
ENEA Data, Stockholm
sommar@enea.se
"Frequently, unexpected errors are entirely unpredictable" - Digital Equipment

^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: Limited Use Clause
@ 1988-12-10 23:13 Erland Sommarskog
  1988-12-12 15:47 ` Steve Tynor
  0 siblings, 1 reply; 14+ messages in thread
From: Erland Sommarskog @ 1988-12-10 23:13 UTC (permalink / raw)


Steve Tynor (tynor@pyr.UUCP) writes:
>But why limit this to only infix operators? How about borrowing an idea 
>from Modula2?
>
> 	with XYZ;
> 	use XYZ."=", XYZ."/=", XYZ.PUSH, XYZ.POP;
> 	package ...

The problem is that the specifications above are not necessarily
unique. So you have to write:
   use XYZ."="(a, b : XYZ_type), XYZ.Push(x : some_type) ...
which quickly gets very verbose.

The original idea that there should be method for making only
infix operators directly visible seems attractive to me.
    A := B My_type."+" C
looks really ugly. 
  As for those who wanted the APSE to handle the problems with USE:
The code I want to read is the code I am to maintain. I prefer not
having to look up cross-reference lists for every name I meet. 
(Particulary cumbersome if you read the program on the Underground
on your way home.)

Let me also add that you have to have your USE clause in the head
of the package. A USE clause can appear in any declarative section.
A local USE is not so confusing as a global one.
-- 
Erland Sommarskog
ENEA Data, Stockholm
sommar@enea.se
"Frequently, unexpected errors are entirely unpredictable" - Digital Equipment

^ permalink raw reply	[flat|nested] 14+ messages in thread
* Limited Use Clause
@ 1988-12-06 16:26 rracine
  1988-12-06 19:12 ` Steve Tynor
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: rracine @ 1988-12-06 16:26 UTC (permalink / raw)


Yet again the "use" clause is maligned.  I did not get the author or the
posting to include here, but the jist of the comment is that the 'use'
clause should not be used (no reasons were given) and a more specific
kind of 'use' clause should be available in Ada 9x.

That is beginning to be the same as the statement "Ada tasking is too slow."
People have said it so long (since it used to be true) that it is accepted
without any arguments.  Why not use the unrestricted 'use'?  The only
reason I have heard that can not be refuted is that it makes it hard to tell
where to find things in source code.  That argument is not a language issue,
however.  It is a Programming Support Environment issue.  The compiler
knows where the various procedures are declared.  Why can't it give us a
cross-reference listing at the end of each compilation?  

In the meantime, at least DEC has provided some tools that give some of
this functionality, and I believe that there are some PC-based tools that 
allow one to find references to identifiers.

Saying "Don't use 'use'" tells me a lot about a project.  It is not using
a sufficient APSE.  It has people who complain about Ada, since they 
probably have difficulty reading their code.  And they are probably behind
schedule, for similar reasons.

I hope this generates some discussion.

Roger Racine
C. S. Draper Laboratory, Inc.

^ permalink raw reply	[flat|nested] 14+ messages in thread
* Limited Use Clause
@ 1988-12-05 23:39 Brian D. Nettleton @spot
  1988-12-06 15:36 ` Steve Tynor
  0 siblings, 1 reply; 14+ messages in thread
From: Brian D. Nettleton @spot @ 1988-12-05 23:39 UTC (permalink / raw)


Mike Glasgow of IBM asked me to post this idea here as he doesn't
have access to this network.

Mike and I discussed yet another change to Ada for Ada-9x, the
addition of a "limited" use clause.  This clause would allow
direct visibility of only the implicit infix operators of a visible part
of a particular package.  I do beleive this request does probably
fall into Stanley Allen's reference to "feature junkies" but that
still doesn't stop me.  The syntax might go something like (included
here only for example, I don't care too much about what words are
chosen):

  with xyz;
  ...
  use limited xyz;
  ...

As more of a maintainer of code than a developer (much of my work
involves porting and integrating other peoples code) I'm certainly
aware of how horrible use clauses can be when your looking at someone
else's code.  Therefore I agree with the coding standard Mike's project at
IBM is using which does not permit any use clauses.  I also agree with
Mike that the restriction causes unnecessary problems when you define
a derived type of say integer and then using this derived type and it's 
associated implied operators is a real pain with lots of extra "noise" 
code (i.e. renaming "=" and "+" over and over again even though they have 
the "standard" Ada definition).

Brian Nettleton
TeleSoft

- These ideas are my own and not necessarily that of my employer, etc...

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~1988-12-19 14:17 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1988-12-17 21:56 Limited Use Clause Erland Sommarskog
1988-12-18 14:48 ` Dik T. Winter
1988-12-19 14:17 ` Steve Tynor
  -- strict thread matches above, loose matches on Subject: below --
1988-12-10 23:13 Erland Sommarskog
1988-12-12 15:47 ` Steve Tynor
1988-12-06 16:26 rracine
1988-12-06 19:12 ` Steve Tynor
1988-12-07  1:43 ` Michael Peirce
1988-12-07 18:12   ` Stephe Leake
1988-12-09 13:58   ` Burch Seymour
1988-12-07 17:59 ` Stephe Leake
1988-12-05 23:39 Brian D. Nettleton @spot
1988-12-06 15:36 ` Steve Tynor
1988-12-07 17:54   ` Stephe Leake

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