comp.lang.ada
 help / color / mirror / Atom feed
From: "Nick Roberts" <Nick.Roberts@dial.pipex.com>
Subject: Re: rep clause in generics
Date: 1997/03/20
Date: 1997-03-20T00:00:00+00:00	[thread overview]
Message-ID: <01bc3583$690a4580$2df282c1@xhv46.dial.pipex.com> (raw)
In-Reply-To: dewar.858351753@merv




Robert Dewar <dewar@merv.cs.nyu.edu> wrote in article
<dewar.858351753@merv>...

> The compiler is correct, this is obviously NOT a static expression.
Remember
> a static expression is not an expression which seems to you to be
something
> that the compiler should be able to evaluate at compile time. There are
very
> specific rules, and this does not obey them.
> 
> So when you say to yourself "I thought that ... was a static expression",
> you need to go to the set of rules, and see if they conform to your
thought!
> In this case they don't, you cannot find a rule that says that this 
> expression is static. An expression is non-static unless there is a very
> specific rule in the RM that says that it is static.

A word of explanation...

The attributes of a type which is a formal generic parameter are not
defined in the standard as being static, and in some compilers may vary
during run-time, because of the different ways in which different compilers
may implement generics.

Whilst most compilers will generate new executable code for each generic
instantiation (thus making the generic parameters within each instance
effectively static), some compilers will not (simply generating one piece
of 'generic' code which is passed generic parameters as if they were
subprogram parameters). Some compilers offer a choice.

If the standard defined formal generic parameters as being static, the
second option would be impossible.

Hope this helps.





  reply	other threads:[~1997-03-20  0:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-03-14  0:00 rep clause in generics Jonas Nygren
1997-03-14  0:00 ` Stephen Leake
1997-03-15  0:00   ` Robert Dewar
1997-03-20  0:00   ` Aaro Koskinen
1997-03-14  0:00 ` Robert Dewar
1997-03-20  0:00   ` Nick Roberts [this message]
1997-03-14  0:00 ` Robert A Duff
1997-03-15  0:00   ` Robert Dewar
replies disabled

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