comp.lang.ada
 help / color / mirror / Atom feed
* Access to subprograms
@ 1995-03-20 16:19 Fred Hosch
  1995-03-21 11:12 ` Robert Dewar
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Fred Hosch @ 1995-03-20 16:19 UTC (permalink / raw)



From my casual and uninformed reading of the RM, it 
seems that something like "+"'Access is legal, even,
heaven forbid, for a predefined instance of "+".

Can anyone provide a pointer?

Thanks.

---Fred Hosch
   Comp Sci/University of New Orleans
-- 
Fred Hosch					fred@cs.uno.edu
Computer Science Department			(504)-286-6594
University of New Orleans			(504)-286-7228 (fax)
New Orleans, LA	 70148



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

* Re: Access to subprograms
  1995-03-20 16:19 Access to subprograms Fred Hosch
@ 1995-03-21 11:12 ` Robert Dewar
  1995-03-21 14:47 ` Tucker Taft
  1995-03-22 14:56 ` Norman H. Cohen
  2 siblings, 0 replies; 6+ messages in thread
From: Robert Dewar @ 1995-03-21 11:12 UTC (permalink / raw)


Fred, you can relax, "+" ' Access is not allowed for predefined + because
this operator has convention Intrinsic, and one effect of this convention
(actually almost the ONLY effect) is to forbid 'Access.




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

* Re: Access to subprograms
  1995-03-20 16:19 Access to subprograms Fred Hosch
  1995-03-21 11:12 ` Robert Dewar
@ 1995-03-21 14:47 ` Tucker Taft
  1995-03-22 14:56 ` Norman H. Cohen
  2 siblings, 0 replies; 6+ messages in thread
From: Tucker Taft @ 1995-03-21 14:47 UTC (permalink / raw)


Fred Hosch (fred@play.uno) wrote:

: From my casual and uninformed reading of the RM, it 
: seems that something like "+"'Access is legal, even,
: heaven forbid, for a predefined instance of "+".

No, 'Access is not permitted for subprograms with an "intrinsic"
calling convention, which includes all implicitly declared subprograms,
which includes all predefined operators. 

(To be honest ;-), implicitly declared dispatching operations 
*do* allow 'Access, since these need to exist as separately 
callable subprograms anyway to support dispatching -- and
this includes the predefined "=" on tagged types.)

: Can anyone provide a pointer?

See RM95 3.10.2(32), 6.3.1(4-11).

: Fred Hosch					fred@cs.uno.edu
: Computer Science Department			(504)-286-6594
: University of New Orleans			(504)-286-7228 (fax)
: New Orleans, LA	 70148

-Tucker Taft  stt@inmet.com
Intermetrics, Inc.



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

* Re: Access to subprograms
  1995-03-20 16:19 Access to subprograms Fred Hosch
  1995-03-21 11:12 ` Robert Dewar
  1995-03-21 14:47 ` Tucker Taft
@ 1995-03-22 14:56 ` Norman H. Cohen
  1995-03-28 16:25   ` Tucker Taft
  2 siblings, 1 reply; 6+ messages in thread
From: Norman H. Cohen @ 1995-03-22 14:56 UTC (permalink / raw)


In article <FRED.95Mar20101937@play.uno>, fred@play.uno (Fred Hosch) writes: 

|> From my casual and uninformed reading of the RM, it
|> seems that something like "+"'Access is legal, even,
|> heaven forbid, for a predefined instance of "+".

It's prohibited by RM95 6.3.1, paragraphs 4, 7, and 11.  (Predefined "+"
operators have convention Intrinsic, and 'Access is prohibited for
subprograms with this convention.)  Instead, you can write

   function My_Wrapper (Left, Right: Integer) return Integer is
   begin
      return Left + Right;
   end My_Wrapper;

(or similarly for some other numeric type) and write My_Wrapper'Access.

But why "heaven forbid"?  It would have been easy for the compiler to
generate a wrapper function like this automatically and invisibly, and it
strikes me as a gratuitous nuisance to make the programmer go through the
ritual.  It also makes the language less uniform.

|> Can anyone provide a pointer?

Cute pun.

|> Thanks.

You're welcome.

--
Norman H. Cohen    ncohen@watson.ibm.com



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

* Re: Access to subprograms
  1995-03-22 14:56 ` Norman H. Cohen
@ 1995-03-28 16:25   ` Tucker Taft
  1995-04-03  0:00     ` Sean McNeil
  0 siblings, 1 reply; 6+ messages in thread
From: Tucker Taft @ 1995-03-28 16:25 UTC (permalink / raw)


Norman H. Cohen (ncohen@watson.ibm.com) wrote:
: In article <FRED.95Mar20101937@play.uno>, fred@play.uno (Fred Hosch) writes: 

: |> From my casual and uninformed reading of the RM, it
: |> seems that something like "+"'Access is legal, even,
: |> heaven forbid, for a predefined instance of "+".

: It's prohibited by RM95 6.3.1, paragraphs 4, 7, and 11.  (Predefined "+"
: operators have convention Intrinsic, and 'Access is prohibited for
: subprograms with this convention.)  Instead, you can write

:    function My_Wrapper (Left, Right: Integer) return Integer is
:    begin
:       return Left + Right;
:    end My_Wrapper;

: (or similarly for some other numeric type) and write My_Wrapper'Access.

: But why "heaven forbid"?  It would have been easy for the compiler to
: generate a wrapper function like this automatically and invisibly, and it
: strikes me as a gratuitous nuisance to make the programmer go through the
: ritual.  It also makes the language less uniform.

.. because generating things automatically and invisibly is contrary to
the philosophy of a systems implementation language, IMHO.  Invisible
things interfere with a systems programmer's ability to estimate
accurately the relative time and space performance of various features.
For example, would it be appropriate to use "+"'Access multiple times,
or would this result in multiple copies of such an "invisible" wrapper?

The more things happen "invisibly," the more the time and 
space performance is compiler-dependent, rather than being
dependent on the intrinsic properties of the source program and the 
target machine.

[By the way, this is one reason I don't like Ada's "holey"
enumeration types, since they create hidden compiler-dependent 
time and space overhead in surprising places.]

Predictable performance was an important goal of the Ada 95 features;
occasionally this means the programmer has to work a little harder.

: Norman H. Cohen    ncohen@watson.ibm.com

-Tucker Taft  stt@inmet.com
Intermetrics, Inc.



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

* Re: Access to subprograms
  1995-03-28 16:25   ` Tucker Taft
@ 1995-04-03  0:00     ` Sean McNeil
  0 siblings, 0 replies; 6+ messages in thread
From: Sean McNeil @ 1995-04-03  0:00 UTC (permalink / raw)


In article <D65sAw.3AI@inmet.camb.inmet.com> stt@spock.camb.inmet.com (Tucker Taft) writes:

>   : |> From my casual and uninformed reading of the RM, it
>   : |> seems that something like "+"'Access is legal, even,
>   : |> heaven forbid, for a predefined instance of "+".
>
>   : It's prohibited by RM95 6.3.1, paragraphs 4, 7, and 11.  (Predefined "+"
>   : operators have convention Intrinsic, and 'Access is prohibited for
>   : subprograms with this convention.)  Instead, you can write
>
>   :    function My_Wrapper (Left, Right: Integer) return Integer is
>   :    begin
>   :       return Left + Right;
>   :    end My_Wrapper;
>
[...]

Does a renamed Predefined "+" operator also have convention Intrinsic status?

i.e.

function My_Plus(Left, Right : Integer) return Integer renames "+";

I assume it is, but I'd thought I'd ask.

Sean McNeil




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

end of thread, other threads:[~1995-04-03  0:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-03-20 16:19 Access to subprograms Fred Hosch
1995-03-21 11:12 ` Robert Dewar
1995-03-21 14:47 ` Tucker Taft
1995-03-22 14:56 ` Norman H. Cohen
1995-03-28 16:25   ` Tucker Taft
1995-04-03  0:00     ` Sean McNeil

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