comp.lang.ada
 help / color / mirror / Atom feed
* Measurements components(need language lawyer input)
@ 1996-03-20  0:00 Mitchell E. James
  1996-03-20  0:00 ` Jonas Nygren
  1996-03-20  0:00 ` Robert A Duff
  0 siblings, 2 replies; 3+ messages in thread
From: Mitchell E. James @ 1996-03-20  0:00 UTC (permalink / raw)


The following message from Ed Falis suggests a need for input on the
legality of a construct that I am using in Measurement Types.  It took
several iterations of gnat and a few very confusing email messages
with Team Ada to get gnat to compile generic children.  The basic part
of Measurement Types compiles fine under the latest version of gnat.
Though I think that there is a gnat related problem with one of the
next layers as noted in the readme file.  I am not a language lawyer,
so those that feel so inclined go ahead and comment.
-------------------------------------------------
Mitchell James
mjames@cyberhighway.net

Fleming's discovery of penicillin was made by accident when a speck of

dust happened to land on an uncovered culture plate.  Touring a modern
research laboratory some years later, he observed with interest the 
sterile, dust-free, air-conditioned environment in which the
scientists
worked.  "What a pity you did not have a place like this to work in,"
said his guide.  "Who can tell what you might have discovered in such
surroundings!"
"Not penicillin," remarked Fleming with a smile.
-------------------------------------------------
Mitchell,

I downloaded your components today, and tried compiling them with the
beta version of our ObjectAda compiler.

I immediately ran into a problem with the compilation of Unit.M1.

The compiler stated that Unit was not recognized as a generic for the 
purposes of providing the formal package to Unit.M1.

I suspect that the compiler is correct, because M1 is supposed to be 
logically nested within Unit, and therefore Unit isn't fully defined
to be provided as a formal package parameter.  Note that I'm not sure
of this.   Perhaps you want to throw it out to some of the language
lawyers?

Here's a simpler example that yields the same problem:

generic
   type t is private;
package p is
   x:t;
end;

-- This one gets the error:
generic
   with package other is new p(<>);
package p.child is
   y: other.t;
end p.child;

-- this one doesn't:
with p;
generic
   with package other is new p(<>);
package q is
   y: other.t;
end q;

- Ed

Ed Falis	
Thomson Software   falis@thomsoft.com	(617) 221-7341
========================================================
Ideological disarmament: a koan for the 21st century
========================================================







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

* Re: Measurements components(need language lawyer input)
  1996-03-20  0:00 Measurements components(need language lawyer input) Mitchell E. James
  1996-03-20  0:00 ` Jonas Nygren
@ 1996-03-20  0:00 ` Robert A Duff
  1 sibling, 0 replies; 3+ messages in thread
From: Robert A Duff @ 1996-03-20  0:00 UTC (permalink / raw)


In article <4inncp$cr2@host-3.cyberhighway.net>,
Mitchell E. James <mjames@spectra.net> wrote:
>generic
>   type t is private;
>package p is
>   x:t;
>end;
>
>-- This one gets the error:
>generic
>   with package other is new p(<>);
>package p.child is
>   y: other.t;
>end p.child;
>
>-- this one doesn't:
>with p;
>generic
>   with package other is new p(<>);
>package q is
>   y: other.t;
>end q;

I believe that's correct.  When you're inside a generic package, the
name of the generic package denotes the "current instance", which is a
package, not a generic package.  I'm too lazy to look up the RM
reference for you right now, but I'm pretty sure it's somewhere in 8.6.
Check "current instance" in the index.

So, in the P.Child case, P is a package, not a generic package.  A child
is logically *inside* its parent's declarative region, even though it is
physically separate.

In the case of Q, you're not inside P, so referring to P refers to the
generic package as usual.

I'm curious: What were you trying to do by having a generic formal
package that's an instance of the parent generic package?

- Bob




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

* Re: Measurements components(need language lawyer input)
  1996-03-20  0:00 Measurements components(need language lawyer input) Mitchell E. James
@ 1996-03-20  0:00 ` Jonas Nygren
  1996-03-20  0:00 ` Robert A Duff
  1 sibling, 0 replies; 3+ messages in thread
From: Jonas Nygren @ 1996-03-20  0:00 UTC (permalink / raw)


Mitchell E. James wrote:
> 
> The following message from Ed Falis suggests a need for input on the
> legality of a construct that I am using in Measurement Types.  It took
> several iterations of gnat and a few very confusing email messages
> with Team Ada to get gnat to compile generic children.  The basic part
> of Measurement Types compiles fine under the latest version of gnat.
> Though I think that there is a gnat related problem with one of the
> next layers as noted in the readme file.  I am not a language lawyer,
> so those that feel so inclined go ahead and comment.
> -------------------------------------------------
> Mitchell James
> mjames@cyberhighway.net<snip>
> Here's a simpler example that yields the same problem:
> 
> generic
>    type t is private;
> package p is
>    x:t;
> end;
> 
> -- This one gets the error:
> generic
>    with package other is new p(<>);
> package p.child is

-- Try using:
     type t is new other.t;
     y : t;

-- This has worked for me with tagged types even if I have encountered
-- other problems, which I have sent out a question about to c.l.a

>    y: other.t;
> end p.child;
> 
> -- this one doesn't:
> with p;
> generic
>    with package other is new p(<>);
> package q is
>    y: other.t;
> end q;
> 
> - Ed
> 
> Ed Falis
> Thomson Software   falis@thomsoft.com   (617) 221-7341
> ========================================================
> Ideological disarmament: a koan for the 21st century
> ========================================================

-- 

-------------------------------------------------------
--    Jonas Nygren
--    ehsjony@ehs.ericsson.se
-------------------------------------------------------




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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-03-20  0:00 Measurements components(need language lawyer input) Mitchell E. James
1996-03-20  0:00 ` Jonas Nygren
1996-03-20  0:00 ` Robert A Duff

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