comp.lang.ada
 help / color / mirror / Atom feed
* LRM 4.1.3 paragraphs 17-19
@ 1991-02-14  3:41 Michael Feldman
  0 siblings, 0 replies; 9+ messages in thread
From: Michael Feldman @ 1991-02-14  3:41 UTC (permalink / raw)


In article <009442AE.D4BD5E20@uno.edu> jncs@uno.edu writes:
>In article <2715@sparko.gwu.edu>, mfeldman@seas.gwu.edu (Michael Feldman) writes:
>>In article <1991Feb12.154418@riddler.Berkeley.EDU> yow@riddler.Berkeley.EDU (Billy Yow 283-4009) writes:
>>>  
>>
>>Another is the parameter passing scheme, in which reference semantics can
>>be used to pass arrays to IN parameters with no danger that the actual
>>will be changed (because IN parameters can't be written to).
>>Less copying (though a colleague of mine pointed out that the extra
>>indirection could actually make the program _slower_.)
>>
>The LRM leaves to the implementor to actually decide on the method of parameter
>passing IMPLEMENTATION in the case of structured types and IN parameters. I
>may use IN for arrays hoping for the COPY-semantics, but the LRM tells me not
>to trust it!

Well, there are two reasons for desiring copy-semantics. The first is to
guard against alteration of the actual. But this is automatic with an IN
parameter, since an attempt to write into the IN parameter is caught by
the compiler. The other only applies to OUT or IN OUT -  if the procedure
propagates an exception, the old values are still in the actual. Since IN
parameters aren't written to (by definition), this is a moot point.

For an IN OUT scalar, you are always safe in assuming copy. For a structured
type, as you point out this is up to the implementer. In fact, most pass
large structures by reference, to save copying time and space. So you're
out of luck on the exception issue, but on the alteration issue you are
_still_ safe, because even if the array is passed by reference, you
cannot change an IN parameter. IMHO this is NEAT.

So tell me - why do you care if an IN parameter is passed by copy or reference?

Mike Feldman

^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: Ada Test Tools
@ 1991-02-08  6:34 Scott Layson
  1991-02-09  2:39 ` LRM 4.1.3 paragraphs 17-19 Joe Vlietstra
  0 siblings, 1 reply; 9+ messages in thread
From: Scott Layson @ 1991-02-08  6:34 UTC (permalink / raw)


I am implementing an Ada front end (more or less) and I have
come across a rule in the (mostly very precise) manual that
seems unclear.  Perhaps someone can help me with it.

It has to do with paragraphs 18 and 19 of section 4.1.3.
(Please refer to the manual at this point.)  Paragraph 17 talks
about four kinds of named constructs whose names can be used as
the prefix of an expanded name.  Paragraphs 18 and 19 give
additional rules about only two of those kinds of constructs,
viz., subprograms and accept statements.  What about block
statements and loop statements?

Thanks in advance,

Scott Burson
Gyro@Reasoning.COM

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

end of thread, other threads:[~1991-02-15  4:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1991-02-14  3:41 LRM 4.1.3 paragraphs 17-19 Michael Feldman
  -- strict thread matches above, loose matches on Subject: below --
1991-02-08  6:34 Ada Test Tools Scott Layson
1991-02-09  2:39 ` LRM 4.1.3 paragraphs 17-19 Joe Vlietstra
1991-02-11 14:57   ` Michael Feldman
1991-02-12  9:48     ` (George C. Harrison) Norfolk State University
1991-02-12 19:13       ` Michael Feldman
1991-02-12 21:44         ` Billy Yow 283-4009
1991-02-13  4:32           ` Michael Feldman
1991-02-13 16:32             ` jncs
1991-02-15  4:11     ` Jim Showalter

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