comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Rough proposal to make some generic types static
Date: Tue, 22 Jul 2014 00:28:07 +0300
Date: 2014-07-22T00:28:07+03:00	[thread overview]
Message-ID: <c35eulF71gvU1@mid.individual.net> (raw)
In-Reply-To: <lqjumj$smj$1@speranza.aioe.org>

On 14-07-21 23:54 , Victor Porton wrote:
> Victor Porton wrote:
> 
>> What in the RM signifies that Enum_Type (below) is not a static scalar
>> type?

(Just as a reminder: Enum_Type is a formal type in a generic:

   generic
      type Enum_Type is (<>);
   ...
)

> I've found: RM 4.9 26/3:
> 
> "A static scalar subtype is an unconstrained scalar subtype whose type is 
> not a descendant of a formal type, or ..."
> 
> Why this rule? Can it be relaxed?

As I understand it, this rule (and others similar to it) allow compilers
to create "shared code" generics, that is, to compile a generic unit
into a single set of machine code that works for all instances of the
generic, thus reducing code size at the cost of possibly increasing
execution time.

One compiler using shared code generics is Janus/Ada from RR Software.

>> We should work on an amendment for a future version of Ada to make
>> Enum_Type static.
>>
>> Is it difficult to implement this?

It would probably make it impossible or very hard to compile shared code
for generic units.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
      .      @       .

  reply	other threads:[~2014-07-21 21:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-21 20:44 Rough proposal to make some generic types static Victor Porton
2014-07-21 20:54 ` Victor Porton
2014-07-21 21:28   ` Niklas Holsti [this message]
2014-07-21 21:32     ` Victor Porton
2014-07-21 21:43       ` Niklas Holsti
2014-07-21 23:10       ` Randy Brukardt
2014-07-21 21:39 ` Adam Beneschan
2014-07-21 21:44   ` Victor Porton
2014-07-21 21:54     ` Adam Beneschan
2014-07-21 21:58       ` Victor Porton
2014-07-22  0:20         ` Randy Brukardt
2014-07-23 21:36         ` Robert A Duff
2014-07-21 22:06       ` Shark8
2014-07-21 23:12     ` Randy Brukardt
2014-07-22  9:53       ` AdaMagica
2014-07-22 21:10         ` Randy Brukardt
replies disabled

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