comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Instantiations of a generic with often encountered arguments
Date: Mon, 27 Nov 2017 09:41:52 +0100
Date: 2017-11-27T09:41:52+01:00	[thread overview]
Message-ID: <ovgj4h$iqs$1@gioia.aioe.org> (raw)
In-Reply-To: ovfrna$1hkd$1@gioia.aioe.org

On 27/11/2017 03:02, Victor Porton wrote:

> I received what seems two opposite opinions on my question.

Opinions meant to be different...

> Please state the reasons.
> 
> I am now in analysis-paralysis of whether to define instantiations for often
> encountered types in advance (globally) or immediately before use.

The latter is C++ policy which is acceptable because in C++ there is no 
lingering effects of an act of instantiation. Therefore C++ can deploy 
automatic instantiation and need not to care how frequently you do so. 
In Ada instantiation has consequences. Consider:

generic
    ...
package Printer is
    procedure Print (Text : String);
private
    task Monitor is
       entry Do_Print (Text : String);
    end Monitor;
end Printer;

Each instance produces a new task.

"Don't multiply entities beyond necessity"

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


  parent reply	other threads:[~2017-11-27  8:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-26  0:04 Instantiations of a generic with often encountered arguments Victor Porton
2017-11-26  2:24 ` gautier_niouzes
2017-11-26  8:52 ` Dmitry A. Kazakov
2017-11-27  2:02   ` Victor Porton
2017-11-27  8:00     ` Simon Wright
2017-11-27  8:41     ` Dmitry A. Kazakov [this message]
2017-11-27 16:05     ` Shark8
replies disabled

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