comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam@spam.com>
Subject: Re: Controlled types and exception safety
Date: Thu, 08 Dec 2005 19:37:01 GMT
Date: 2005-12-08T19:37:01+00:00	[thread overview]
Message-ID: <xX%lf.800$n1.254@newsread2.news.pas.earthlink.net> (raw)
In-Reply-To: <Av2dnWucM4bfHwreRVn-gQ@megapath.net>

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



  reply	other threads:[~2005-12-08 19:37 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-30 13:57 Controlled types and exception safety Maciej Sobczak
2005-11-30 15:06 ` Dmitry A. Kazakov
2005-11-30 16:19   ` Maciej Sobczak
2005-12-01  0:05     ` Stephen Leake
2005-12-01  9:21     ` Dmitry A. Kazakov
2005-12-01 10:46       ` Maciej Sobczak
2005-12-01 15:08         ` Dmitry A. Kazakov
2005-12-02  4:17           ` Randy Brukardt
2005-12-02  9:29             ` Maciej Sobczak
2005-12-02 18:12               ` tmoran
2005-12-02 19:15                 ` Robert A Duff
2005-12-02 21:42                   ` tmoran
2005-12-06  9:00                     ` Maciej Sobczak
2005-12-06  9:50                       ` Dmitry A. Kazakov
2005-12-06 18:34                         ` Jeffrey R. Carter
2005-12-06 19:34                           ` Randy Brukardt
2005-12-06 21:20                             ` Dmitry A. Kazakov
2005-12-07  1:57                             ` Jeffrey R. Carter
2005-12-08  0:50                               ` Randy Brukardt
2005-12-08 19:37                                 ` Jeffrey R. Carter [this message]
2005-12-09  2:36                                   ` Randy Brukardt
2005-12-09  6:33                                     ` Jeffrey R. Carter
2005-12-09 20:35                                       ` Randy Brukardt
2005-12-10  7:53                                         ` Jeffrey R. Carter
2005-12-06 20:43                           ` Dmitry A. Kazakov
2005-12-07  2:00                             ` Jeffrey R. Carter
2005-12-07 10:01                               ` Dmitry A. Kazakov
2005-12-02 23:21             ` Robert A Duff
2005-11-30 17:46 ` Jean-Pierre Rosen
2005-11-30 21:02 ` Jeffrey R. Carter
2005-11-30 22:06   ` Björn Persson
2005-11-30 23:52     ` Randy Brukardt
2005-12-01  5:26     ` Jeffrey R. Carter
2005-12-02 23:51       ` Robert A Duff
2005-12-06 11:41   ` Peter C. Chapin
2005-12-06 12:50     ` Jean-Pierre Rosen
2005-12-06 13:06     ` Dmitry A. Kazakov
replies disabled

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