comp.lang.ada
 help / color / mirror / Atom feed
From: Keean Schupke <keean.schupke@googlemail.com>
Subject: Re: Signature Package With Generic Proceedure
Date: Tue, 24 Jul 2012 01:02:55 -0700 (PDT)
Date: 2012-07-24T01:02:55-07:00	[thread overview]
Message-ID: <df151d92-5aea-4a1d-89c3-80324db9a0b9@googlegroups.com> (raw)
In-Reply-To: <jul2n4$af5$1@munin.nbi.dk>

On Tuesday, 24 July 2012 03:53:20 UTC+1, Randy Brukardt  wrote:
> &quot;Keean Schupke&quot; wrote in message 
> ...
> &gt; This is datatype generic programming, one of the things I thought Ada is 
> &gt; good at.
> &gt; Signatures are the only way in Ada of doing this with no runtime cost, and 
> &gt; the only way
> &gt; using generics. Signatures belong to a family of constructs across several 
> &gt; languages with
> &gt; similar properties. For example:
> 
> There&#39;s nothing in Ada that says generics have to be implemented with &quot;no 
> runtime cost&quot;. Many Ada 83 implementations, and a few more recent 
> implementations, share all generic instantiations. The effect is very 
> similar to tagged type dispatching, and it&#39;s most useful when there are a 
> lot of instances in a program. Janus/Ada certainly does this (it might be 
> the last to do &quot;universal generic sharing&quot;). Some Ada implementations do 
> &quot;partial generic sharing&quot;, where the parameters involved determine if 
> sharing is used.
> 
> Normally, at this point, I&#39;d say something about premature optimization, but 
> I realize from your past messages that you&#39;re already beyond that stage, so 
> I won&#39;t say any more.
> 
>                                        Randy.

Using DG is a choice like using OO. Languages seem to be very keen to add features to support OO programming. The zero run time cost is 'potential' because all types can be statically determined at compile time. GNAT does this (maybe because it shares a backend with C++)

DG is my programming style of choice at the moment, so some of this is about exploring different languages support for it. At some point C++ has probably overtaken Ada in this regard. Haskell is great but performance is not always good.

At the moment the code written in Ada using Signatures and access variables is faster than C++ (by a couple of percent) when both compiled with GCC.


Cheers,
Keean.



  parent reply	other threads:[~2012-07-26 14:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <045f7b44-2a4a-4292-80fd-0b6bc8ee3465@googlegroups.com>
2012-07-21 22:22 ` Signature Package With Generic Proceedure Adam Beneschan
2012-07-22  7:28   ` Dmitry A. Kazakov
2012-07-22 16:22   ` Keean Schupke
2012-07-23  0:45     ` Adam Beneschan
     [not found]       ` <79925d0c-b2dd-44a3-9451-48f0ee19485f@googlegroups.com>
     [not found]         ` <500d3a9d$0$6566$9b4e6d93@newsspool4.arcor-online.net>
2012-07-23 18:29           ` Keean Schupke
     [not found]         ` <ac8bfaed-dbcc-491a-a760-c25672445eef@googlegroups.com>
2012-07-23 19:41           ` Keean Schupke
2012-07-24  2:57         ` Randy Brukardt
     [not found]         ` <jul2n4$af5$1@munin.nbi.dk>
2012-07-24  8:02           ` Keean Schupke [this message]
2012-07-24  8:43             ` Dmitry A. Kazakov
2012-07-24  8:59               ` Keean Schupke
2012-07-23 10:26 ` Simon Wright
2012-07-23 18:36   ` Keean Schupke
replies disabled

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