comp.lang.ada
 help / color / mirror / Atom feed
From: emery@MITRE-BEDFORD.ARPA (Emery)
Subject: Generics: 'Retraction' and an example
Date: 6 Sep 88 13:31:28 GMT	[thread overview]
Message-ID: <8809061331.AA11160@mitre-bedford.ARPA> (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

             reply	other threads:[~1988-09-06 13:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1988-09-06 13:31 Emery [this message]
1988-09-07 21:50 ` Generics: 'Retraction' and an example Chris Henrich
replies disabled

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