From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM,NICE_REPLY_A,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Rod Kay Newsgroups: comp.lang.ada Subject: Re: Why don't all initialising assignments use 'build-in-place' ? Date: Sun, 26 Mar 2023 16:10:33 +1100 Organization: A noiseless patient Spider Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 26 Mar 2023 05:10:30 -0000 (UTC) Injection-Info: dont-email.me; posting-host="4d94c0ebe916b2402e359aa2b7beb2a0"; logging-data="2706742"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19UCImV95r+7FyE5yE+W05fheYHnU4Hbws=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Cancel-Lock: sha1:z+hNB9u4k3AebGMCbma3ht762kg= In-Reply-To: Content-Language: en-US Xref: feeder.eternal-september.org comp.lang.ada:65021 List-Id: On 25/3/23 19:39, Randy Brukardt wrote: > "Rod Kay" wrote in message > news:tvc6j9$3gfe$1@dont-email.me... >> Hello again, >> >> I'm sure there must be a good reason. All I can think of is that it may >> somehow break backwards compatibility wrt controlled types (a vague stab >> in the dark). >> >> Any thoughts ? > > (1) Didn't want to make work for implementers. > (2) You shouldn't be able to tell (since it is required for all cases > involved finalization). Finalization is the only way to inject user-defined > code into the initialization process. > (3) True build-in-place can be expensive and complex (especially for array > types). > (4) Build-in-place requires functions compiled to support it (must pass in > the place to initialize into). That might not be the case (especially if a > foreign convention is involved). Also see (3) - an implementation might have > a cheaper way to return some types that doesn't support build-in-place. > > There's probably more, those are off the top of my head. If it is cheap, it > would be silly for an implementation to do anything else. (Don't ask what > Janus/Ada does. ;-) Otherwise, most people want the fastest possible code. > > Randy. > > > Thanks, Randy. I somehow imagined that build-in-place would be faster :/. So using 'extended return' *everywhere* would decrease performance, I guess. Cheers.