comp.lang.ada
 help / color / mirror / Atom feed
* Generics: 'Retraction' and an example
@ 1988-09-06 13:31 Emery
  1988-09-07 21:50 ` Chris Henrich
  0 siblings, 1 reply; 2+ messages in thread
From: Emery @ 1988-09-06 13:31 UTC (permalink / raw)


Earlier I said: 
  "Furthermore, Verdix does NOT require that the body of a generic be
   compiled before its instantiation.  It is possible to write mutually
   dependent generics (each generic instantiates the other) in Verdix,
   where most compilers will gag on such code."

Wayne Wylupski and Dave Bakin replied, citing LRM 12.3(18):

  "Recursive generic instantiation is not allowed in the following
   sense:  if a given generic unit includes an instantiation of a
   second generic unit, then the instance generated by this
   instantiation must not include an instance of the first generic
   unit (whether this instance is generated directly, or indirectly
   by intermediate instantiations)."
  
They're right.  You can't do recursive generic instantiation.

However, here's an example of something that I can do on Verdix that
DEC and (some) other compilers do not like.  I believe this is legal Ada.  

package A is
  
  generic
  package B is
    function foo return integer;
  end B;
  
end A;

package body A is
  x : integer;
  
  package body B is separate;
  
  package my_b is new b;
  -- some compilers don't like this instantiation
  -- DEC (VMS 1.3-24) and Tartan (Sun 2.0) are two that don't 
  -- Verdix (Sun 5.5j) compiles this just fine.
begin
  x := my_b.foo;
end A;

separate (A)
package body B is
  function foo return integer is
  begin
    return 42;  -- life, the universe, and everything...
  end foo;
end B;
				
				dave emery
				emery@mitre-bedford.arpa

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

* Re: Generics: 'Retraction' and an example
  1988-09-06 13:31 Generics: 'Retraction' and an example Emery
@ 1988-09-07 21:50 ` Chris Henrich
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Henrich @ 1988-09-07 21:50 UTC (permalink / raw)


In article <8809061331.AA11160@mitre-bedford.ARPA> emery@MITRE-BEDFORD.ARPA.UUCP writes:
>
>However, here's an example of something that I can do on Verdix that
>DEC and (some) other compilers do not like.  I believe this is legal Ada.  
I believe so too, and Concurrent Computer Corporation's compiler
seems to handle it correctly.
>
>package A is
>  
>  generic
>  package B is
>    function foo return integer;
>  end B;
>  
>end A;
>
>package body A is
>  x : integer;
>  
>  package body B is separate;
>  
>  package my_b is new b;
>  -- some compilers don't like this instantiation
>  -- DEC (VMS 1.3-24) and Tartan (Sun 2.0) are two that don't 
>  -- Verdix (Sun 5.5j) compiles this just fine.
>begin
>  x := my_b.foo;
>end A;
>
>separate (A)
>package body B is
>  function foo return integer is
>  begin
>    return 42;  -- life, the universe, and everything...
>  end foo;
>end B;
>				
>				dave emery
>				emery@mitre-bedford.arpa
Regards,
Chris

UUCP:       ...!rutgers!petsd!cjh            
Concurrent Computer Corporation is a Perkin-Elmer company.

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

end of thread, other threads:[~1988-09-07 21:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1988-09-06 13:31 Generics: 'Retraction' and an example Emery
1988-09-07 21:50 ` Chris Henrich

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