Re: Controlled types and exception safety
- From: "Jeffrey R. Carter" <spam@xxxxxxxx>
- Date: Thu, 08 Dec 2005 19:37:01 GMT
Randy Brukardt wrote:
Now, how is this assignment performed if we're using the default assignment here? Since we need to component, we need to call the Assign procedure on the component C, but what left-hand side to pass as To? There isn't a component O.C in the left-hand side!
I guess I'm still missing something. Default assignment to a record with discriminants, or at least that changes the discriminants, invoking 'Assign for a component, would assign to an intermediate with the correct discriminants, which is then copied into the target as is currently done.
Working out the rules is probably complicated, and hardly worth the effort since Ada uses another mechanism, but I'm still not convinced it couldn't be done.
Probably because IANALL and I'm missing something.
Maybe Ada 200Y limited types and Assign procedures would be adequate, but certainly not the Ada 95 variety. Ada 95 limited types don't allow (1) aggregates; (2) constants; (3) useful functions; or (4) any sort of complex initialization. Which means that you can't use many of the techniques that help reduce bugs in Ada (such as letting the compiler check that all components have been given in an aggregate). And limited types also block most optimizations by their very nature. That's useful in some cases, but in others you'd rather let the compiler eliminate extra temporaries and Finalizes. (That's allowed for non-limited types, but never for limited types.)
I've always felt that preventing the use of aggregates was an important part of limited types. Constants don't seem like a problem, since they can be implemented as functions. You can pass function results to the From parameter of Assign.
Complex default initialization requires some work, but I was able to do some pretty complex default initialization using functions as default initial values in Ada 83. Preventing user-defined initialization seems like an important part of limited types.
-- Jeff Carter "Why don't you bore a hole in yourself and let the sap run out?" Horse Feathers 49 .
- Follow-Ups:
- Re: Controlled types and exception safety
- From: Randy Brukardt
- Re: Controlled types and exception safety
- References:
- Re: Controlled types and exception safety
- From: Robert A Duff
- Re: Controlled types and exception safety
- From: tmoran
- Re: Controlled types and exception safety
- From: Maciej Sobczak
- Re: Controlled types and exception safety
- From: Dmitry A. Kazakov
- Re: Controlled types and exception safety
- From: Jeffrey R. Carter
- Re: Controlled types and exception safety
- From: Randy Brukardt
- Re: Controlled types and exception safety
- From: Jeffrey R. Carter
- Re: Controlled types and exception safety
- From: Randy Brukardt
- Re: Controlled types and exception safety
- Prev by Date: Re: 'Base
- Next by Date: Re: 'Base
- Previous by thread: Re: Controlled types and exception safety
- Next by thread: Re: Controlled types and exception safety
- Index(es):
Relevant Pages
|