comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <see.my.homepage@gmail.com>
Cc: mailbox@dmitry-kazakov.de
Subject: Re: Ada 2005 puzzle
Date: Fri, 20 Jul 2012 04:30:27 -0700 (PDT)
Date: 2012-07-20T04:30:27-07:00	[thread overview]
Message-ID: <ef226fe1-fdb6-4830-be61-0ea3c7324b80@googlegroups.com> (raw)
In-Reply-To: <1uli63mb1e82x.11cuz41guddr5.dlg@40tude.net>

W dniu piątek, 20 lipca 2012 10:27:15 UTC+2 użytkownik Dmitry A. Kazakov napisał:

> The problem is that a *new* limited object cannot be result of a function,
> this is conceptually broken.

Yes, we have already concluded long time ago that one of the priorities for Ada is to fix the concept of object construction. But in this case I think that Ada has everything that is needed.

> The factory of limited objects passed to
> Insert must provide means to:
> 
> 1. determine the constraints of the object (using some set of arguments);

This is not the container's business and will usually come with the factory itself - or from the context of the factory. That is why I expect this to be used with access to *local* functions, which can drag along all the information that is needed to construct the object.

> 2. construct the object in place (using the arguments again);

Same as above - the constructor function can bring the "arguments" from its surrounding context. You can even create wrappers like this:

procedure Insert_From_Arguments
   (C : in out Container;
    X : in Integer; Y : in Integer; Z : in Integer) is

   function Construct return T is
   begin
      return V : T do
         V.X := X;  -- constructing T from arguments X, Y, Z
         -- ...
      end return;
   end Construct;
begin
   C.Insert (Construct'Access);
end Insert_From_Arguments;

Above, the arguments are passed as part of the Construct's environment.

> 3. optionally, construct the class-wide object upon the specific object
> (using the arguments)

I expect that class-wide is what the container sees (for example, by being instantiated with such a type) - the rest happens the usual way, by initializing the class-wide placeholder with specific constructed object. This way you could naturally have a container of OO objects.

> 1-3 cannot be effectively fused into single operation

Why? What's wrong (ie. what is ineffective) with the above?

-- 
Maciej Sobczak * http://www.msobczak.com * http://www.inspirel.com



  reply	other threads:[~2012-07-26 15:03 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-12 12:54 Ada 2005 puzzle Dmitry A. Kazakov
2012-07-12 15:48 ` Adam Beneschan
2012-07-12 16:34   ` Dmitry A. Kazakov
2012-07-19  6:53     ` Randy Brukardt
2012-07-19  7:55       ` Dmitry A. Kazakov
2012-07-20  2:22         ` Randy Brukardt
2012-07-20  7:20           ` Dmitry A. Kazakov
2012-07-21  0:04             ` Randy Brukardt
2012-07-21  8:34               ` Dmitry A. Kazakov
2012-07-24  2:38                 ` Randy Brukardt
2012-07-24  4:23                   ` Adam Beneschan
2012-07-24  7:54                     ` Dmitry A. Kazakov
2012-07-25 23:39                       ` Randy Brukardt
2012-07-26  7:41                         ` Dmitry A. Kazakov
2012-07-26 13:08                           ` Simon Wright
2012-07-26 13:55                             ` Dmitry A. Kazakov
2012-07-27  9:42                               ` AdaMagica
2012-07-27 10:32                                 ` Dmitry A. Kazakov
2012-07-27 11:58                                   ` Georg Bauhaus
2012-07-27 13:04                                     ` Dmitry A. Kazakov
2012-07-28  9:48                                       ` AdaMagica
2012-07-28 10:37                                         ` Dmitry A. Kazakov
2012-07-28 16:59                                           ` AdaMagica
2012-07-28 18:21                                             ` Dmitry A. Kazakov
2012-07-19  8:04       ` Maciej Sobczak
     [not found]         ` <juaghb$fv9$1@munin.nbi.dk>
2012-07-20  7:30           ` Dmitry A. Kazakov
2012-07-21 17:21             ` Vasiliy Molostov
2012-07-21 19:03               ` Dmitry A. Kazakov
2012-07-21 19:37                 ` Vasiliy Molostov
2012-07-21 20:23                   ` Dmitry A. Kazakov
2012-07-21 20:53                     ` Vasiliy Molostov
2012-07-22  7:41                       ` Dmitry A. Kazakov
2012-07-22  8:00                         ` Vasiliy Molostov
2012-07-22  8:19                           ` Dmitry A. Kazakov
2012-07-22  9:06                             ` Vasiliy Molostov
2012-07-22  9:34                               ` Dmitry A. Kazakov
2012-07-20  8:09           ` Maciej Sobczak
2012-07-20  8:27             ` Dmitry A. Kazakov
2012-07-20 11:30               ` Maciej Sobczak [this message]
2012-07-20 12:49                 ` Dmitry A. Kazakov
2012-07-21 22:46                   ` Maciej Sobczak
2012-07-22  8:03                     ` Dmitry A. Kazakov
2012-07-22 10:08               ` Florian Weimer
2012-07-22 11:18                 ` Dmitry A. Kazakov
2012-07-21  0:12             ` Randy Brukardt
2012-07-22  9:52       ` Florian Weimer
replies disabled

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