From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,fd189a20f95495f3 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Thu, 14 Jul 2011 10:52:59 +0200 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.18) Gecko/20110613 Thunderbird/3.1.11 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Task components, the rationale References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <4e1eae6c$0$6570$9b4e6d93@newsspool3.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 14 Jul 2011 10:53:00 CEST NNTP-Posting-Host: 658dfc79.newsspool3.arcor-online.net X-Trace: DXC=Q\0i9_c[3:3T2Rfi6ejV85jBoT9MkFE1OSIG;^1fVa3 X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:21170 Date: 2011-07-14T10:53:00+02:00 List-Id: On 7/13/11 10:58 PM, Maciej Sobczak wrote: > On Jul 13, 8:52 pm, "Dmitry A. Kazakov" >> There is no simple solution for this. > > You have to just, you know, simply, introduce constructors to the > language. This is my pet feature for Ada 2020. :-) Out of curiosity, would this be enough? How will it work? Assuming, naively, not knowing C++, that constructors of C++ could lead the way, I get #include namespace { class Outer; class Inner { private: Outer* shell; public: Inner(Outer*); }; class Outer { private: Inner i; public: int some_value; Outer(); }; Inner::Inner(Outer* wrap) { this->shell = wrap; std::cout << "initializing inner, this->shell->some_value = " << this->shell->some_value << std::endl; } Outer::Outer() : i(this) { this->some_value = 123; std::cout << "initialized outer, this->some_value = " << this->some_value << std::endl; } } int main() { Outer x; return 0; } $ c++ news23.cpp $ ./a.out initializing inner, this->shell->some_value = 1606422610 initialized outer, this->some_value = 123 $