Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Ada > Re: Limited ini...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 8 of 15 Topic 5621 of 5827
Post > Topic >>

Re: Limited initialization for non-limited types

by "Randy Brukardt" <randy@[EMAIL PROTECTED] > Mar 28, 2008 at 01:56 AM

"Eric Hughes" <eric.eh9@[EMAIL PROTECTED]
> wrote in message
news:05336885-5b45-4b2d-b27c-733c2002ca58@[EMAIL PROTECTED]
> Reviewing:
> 1) Declaration of a function suitable for non-assignment
> initialization.
> 2) New specification of controlled behavior with such initialization.
> 3) Syntactic distinction between assignment and initialization.
>
> I wasn't looking for this when I started this thread, but isn't this
> exactly what's needed to define a proper constructor function?

Exactly, but I think the chances of that happening in Ada are pretty close
to zero. We tried a number of such approaches during the development of
the
Amendment, and we were unable to come up with compelling advantages to a
large pile of new syntax and semantics (other than avoiding a nasty
incompatibility). We eventually decided to go with the incompatibility
instead.

Moreover, I was one of those that was not originally convinced that a
function makes an adequate constructor. But I wasn't able to convince
others, and eventually you have to compromise and move on.

Anyway, the Ada model for non-limited types is to allow compilers to do
extensive optimization of assignment (or not). Code that requires a
particular sequence of calls is wrong (even though it might work).

I still think that your entire approach is wrong. I'd probably either try
something using a mixin generic, or more likely simply with a bit
debugging
code built into the base class. (An extension would also work in some
cases.)

....
> The third consequence is that record extensions would require multiple
> block memory copies.  That means more internal accounting and some
> extra code size.

It would be quite a bit worse than that on some compilers. Combined with
build-in-place and extension aggregates, you probably wouldn't even be
able
to figure out where the components are. (One implementation already has a
problem with this.)

I also wonder what dragons luck in this idea. A lot of good ideas simply
don't work in Ada, because they run afoul of problems with discriminant
dependent components or privacy or the generic contract model or some
combination. It would take quite a bit of thought to ensure that such
problems don't lurk here.

                         Randy.
 




 15 Posts in Topic:
Limited initialization for non-limited types
Eric Hughes <eric.eh9@  2008-03-26 06:26:42 
Re: Limited initialization for non-limited types
Robert A Duff <bobduff  2008-03-26 10:02:46 
Re: Limited initialization for non-limited types
"Dmitry A. Kazakov&q  2008-03-26 16:08:01 
Re: Limited initialization for non-limited types
"Randy Brukardt"  2008-03-26 17:13:14 
Re: Limited initialization for non-limited types
Lucretia <lucretia9@[E  2008-03-26 16:00:15 
Re: Limited initialization for non-limited types
Eric Hughes <eric.eh9@  2008-03-26 17:07:10 
Re: Limited initialization for non-limited types
Eric Hughes <eric.eh9@  2008-03-26 20:25:05 
Re: Limited initialization for non-limited types
"Randy Brukardt"  2008-03-28 01:56:02 
Re: Limited initialization for non-limited types
Martin Krischik <krisc  2008-03-28 12:23:41 
Re: Limited initialization for non-limited types
Eric Hughes <eric.eh9@  2008-03-28 08:25:08 
Re: Limited initialization for non-limited types
"Randy Brukardt"  2008-03-28 16:53:27 
Re: Limited initialization for non-limited types
Eric Hughes <eric.eh9@  2008-03-28 08:47:37 
Re: Limited initialization for non-limited types
Eric Hughes <eric.eh9@  2008-03-28 16:37:04 
Re: Limited initialization for non-limited types
Eric Hughes <eric.eh9@  2008-04-01 20:00:02 
Re: Limited initialization for non-limited types
Eric Hughes <eric.eh9@  2008-04-01 21:06:32 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 0:08:01 CDT 2008.