comp.lang.ada
 help / color / mirror / Atom feed
From: Lucretia <laguest9000@googlemail.com>
Subject: Re: Why can't objects be static in Ada?
Date: Sat, 13 Apr 2019 06:48:53 -0700 (PDT)
Date: 2019-04-13T06:48:53-07:00	[thread overview]
Message-ID: <bd0aca4b-d0e1-4d3a-b340-313478f20a4f@googlegroups.com> (raw)
In-Reply-To: <842b24b2-4b9f-46ae-a173-87b70aac2959@googlegroups.com>

On Saturday, 13 April 2019 14:07:13 UTC+1, Jere  wrote:
> On Thursday, April 11, 2019 at 8:40:40 AM UTC-4, Lucretia wrote:

> >    Zero_Size : constant Sizes := (others => Natural_Dimension'First);
> > 
> > Why can't Zero_Size be compiled as static in this pre-elaborated package?
> > 
> > This seems to be a major flaw in Ada imo.
> > 
> > Luke.
> 
> Out of curiosity, are you looking for something more akin to C++'s
> constexpr [1][2] keyword?  Ada's static definition is kind of like that, 

What I'm after is for the compiler to compile a constant, which as can be seen has it's components initialised from other constants, such that I can then pass the overall constant like Zero_Size, into a generic, in which the whole outer package is pre-elaborated.

> but not as flexible or usable yet.  I'm hoping that at some point Ada 
> does adjust the definition of static to be even more useful.  Most 

I can't believe, in 40 years, nobody has come up against this issue before.

I suppose maybe that constexpr function modifier would be helpful here too, but really the data should be considered static, as in, clearly defined at compile time.

  reply	other threads:[~2019-04-13 13:48 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-11 12:40 Why can't objects be static in Ada? Lucretia
2019-04-11 12:56 ` Mark Lorenzen
2019-04-11 13:31   ` Lucretia
2019-04-11 22:49 ` Randy Brukardt
2019-04-12  1:56   ` Lucretia
2019-04-12  7:33     ` Dmitry A. Kazakov
2019-04-12 22:38     ` Randy Brukardt
2019-04-13  9:14       ` Lucretia
2019-04-12  6:59   ` Mark Lorenzen
2019-04-12  8:12     ` Simon Wright
2019-04-12 22:02     ` Randy Brukardt
2019-04-13 13:07 ` Jere
2019-04-13 13:48   ` Lucretia [this message]
2019-04-15 17:46     ` G. B.
2019-04-14  3:47 ` Keith Thompson
2019-04-16  0:08 ` sbelmont700
2019-04-16  1:40   ` Randy Brukardt
2019-04-16 12:11     ` Mark Lorenzen
2019-04-16 16:19       ` Simon Wright
2019-04-16 20:56       ` Lucretia
2019-04-16 21:07         ` Niklas Holsti
2019-04-16 21:16           ` Lucretia
2019-04-16 21:40             ` Niklas Holsti
2019-04-16 23:26             ` Randy Brukardt
2019-04-23 14:30           ` Mark Lorenzen
2019-04-16 23:09       ` Randy Brukardt
2019-04-22 20:05       ` Norman Worth
2019-04-16 20:54     ` Lucretia
2019-04-16 23:15       ` Randy Brukardt
2019-04-16 20:53   ` Lucretia
2019-04-18 13:32 ` sbelmont700
replies disabled

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