"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.


|