comp.lang.ada
 help / color / mirror / Atom feed
From: Serge Robyns <serge.robyns@gmail.com>
Subject: Re: Bounded String question
Date: Thu, 12 Nov 2015 08:59:53 -0800 (PST)
Date: 2015-11-12T08:59:53-08:00	[thread overview]
Message-ID: <272d6ba6-869f-427d-9395-51dd1d480a3c@googlegroups.com> (raw)
In-Reply-To: <n20947$v1d$2@dont-email.me>

On Wednesday, 11 November 2015 21:42:58 UTC+1, Jeffrey R. Carter  wrote:
> Sorry, I forgot the Drop parameter.

Don't worry, this was very easy to resolve.  I wish all my issues where that easy. ;-)

> These won't work. BS.Null_Bounded_String has type BS.Bounded_String, not OS.
> However, you can convert BS.Null_Bounded_String
> 
> No_OS : constant OS := OS (BS.Null_Bounded_String);
> 
> or create your own
> 
> No_OS : constant OS := To_String ("");

I had both these version in my code (started with To_xyz ("") and then Null_Bounded_String, as the later form is the one I like.  My quest started when I introduced pragma preelaborate.  I started digging into the details without becoming any smarter, on the contrary.  And asked my question here.

> Calling To_String requires elaboration.

I was foolishly hoping that these kind of elaborations could be preelaborated.  But the RM says not and the compiler slaps me.  After working around as mentioned earlier in my discussions I was hit by another slap but this time trying to preelaborate "simple" record types with my constants.  So in the end, I throw the towel and leave it up to the compiler to figure out how to elaborate my code.  So far my attempt to hint and to have nice pure or preelaborated packages.  I'm left with a "hangover". 


> -- 
> Jeff Carter
> "When Roman engineers built a bridge, they had to stand under it
> while the first legion marched across. If programmers today
> worked under similar ground rules, they might well find
> themselves getting much more interested in Ada!"
> Robert Dewar
> 62

From your post, I do understand you are an authority when it comes to language rules.  Am I so mistaken to hope that today's compilers could be smarter in preelaboration besides plain strings and scalars?  Is this something that could be looked at in the next Ada revision?

Serge

  reply	other threads:[~2015-11-12 16:59 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-10 22:00 Bounded String question Serge Robyns
2015-11-11  0:48 ` Bob Duff
2015-11-11  2:01   ` Jeffrey R. Carter
2015-11-11 15:34     ` Bob Duff
2015-11-11 17:36       ` Jeffrey R. Carter
2015-11-11 19:22         ` Bob Duff
2016-03-06 18:59       ` Xavier Petit
2016-03-07 23:16         ` Randy Brukardt
2016-03-08  0:08           ` Jeffrey R. Carter
2016-03-09  1:18             ` Randy Brukardt
2015-11-11 10:52   ` Serge Robyns
2015-11-11 13:43     ` Serge Robyns
2015-11-11 14:32       ` brbarkstrom
2015-11-11 16:08         ` Serge Robyns
2015-11-11 17:27       ` Jeffrey R. Carter
2015-11-11 20:06         ` Serge Robyns
2015-11-11 20:23           ` AdaMagica
2015-11-11 20:27             ` AdaMagica
2015-11-11 20:32             ` Serge Robyns
2015-11-11 20:40               ` AdaMagica
2015-11-12 17:31                 ` Serge Robyns
2015-11-12 19:10                   ` AdaMagica
2015-11-12 21:29                     ` Randy Brukardt
2015-11-12 18:03                 ` G.B.
2015-11-12 18:13                   ` Serge Robyns
2015-11-12 18:14                     ` Serge Robyns
2015-11-12 19:37                   ` Randy Brukardt
2015-11-11 20:42           ` Jeffrey R. Carter
2015-11-12 16:59             ` Serge Robyns [this message]
2015-11-12 18:39               ` Jeffrey R. Carter
2015-11-12 21:19                 ` Randy Brukardt
2015-11-12 21:27               ` Randy Brukardt
2015-11-12 22:32                 ` Jeffrey R. Carter
2015-11-13  0:07                   ` Randy Brukardt
2015-11-13  1:01                     ` Jeffrey R. Carter
2015-11-11 15:41     ` Bob Duff
replies disabled

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