comp.lang.ada
 help / color / mirror / Atom feed
From: "Jerry" <lanceboyle@qwest.net>
Subject: Re: Why does this work? (overloads)
Date: 7 Feb 2007 12:53:43 -0800
Date: 2007-02-07T12:53:43-08:00	[thread overview]
Message-ID: <1170881623.149455.139410@j27g2000cwj.googlegroups.com> (raw)
In-Reply-To: <nnpyh.382004$1i1.366090@attbi_s72>

Jeffrey R. Carter wrote:
> Jerry wrote:
> > (1) Why does the following work?
>
> Because Ada was designed so you can do this.
>
> > (2) Have I done something stupid or dangerous?
>
> No.
>
Excellent. I knew there was some reason that I was using Ada ;).
>
> > -- Some declarations...
> > f, x, H : Real_Vector(0 .. NN - 1);
>
> Note that in mathematics, matrices and vectors are indexed from 1. 1 ..
> NN also avoids the common error of forgetting the "- 1".
>
Yes, but  time series are usually indexed from 0. Sometimes, the FFT
of a time series is indexed from 0 and sometimes -NN/2 .. NN/2-1. When
one uses a time series in a vector or matrix, conundrums obviously
arise, not only in computer code but in print. I once figured out how
to make Pascal let me have it both ways by declaring both types, one
type indexed 0..NN-1 and the other 1..NN, and then I set a pointer of
one type to an array originally declared with another type. I'm
guessing that Ada doesn't allow this, however.

> Because the context of overload resolution for "+" (ARM 8.6) doesn't
> allow this if there is another interpretation that isn't an error.

Thanks for the great explanation.

Jerry




  parent reply	other threads:[~2007-02-07 20:53 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-07  4:39 Why does this work? (overloads) Jerry
2007-02-07  6:45 ` AW: " Grein, Christoph (Fa. ESG)
2007-02-07  7:07   ` Jerry
2007-02-07  7:26     ` AW: " Grein, Christoph (Fa. ESG)
2007-02-07 20:43       ` Jerry
2007-02-07 19:09   ` AW: " Jeffrey R. Carter
2007-02-07 21:13     ` Jerry
2007-02-07 21:33       ` Ludovic Brenta
2007-02-07 21:36       ` Randy Brukardt
2007-02-07 19:02 ` Jeffrey R. Carter
2007-02-07 19:21   ` Adam Beneschan
2007-02-07 19:25     ` Adam Beneschan
2007-02-08  0:51       ` Jeffrey R. Carter
2007-02-07 23:12     ` Robert A Duff
2007-02-08  0:49     ` Jeffrey R. Carter
2007-02-07 20:53   ` Jerry [this message]
2007-02-08  0:53     ` Jeffrey R. Carter
2007-02-08 10:40       ` Jerry
2007-02-08 11:34         ` Georg Bauhaus
2007-02-08 12:05         ` AW: " Grein, Christoph (Fa. ESG)
2007-02-08 18:52         ` Jeffrey R. Carter
2007-02-09  0:56         ` Jerry
2007-02-09  1:27         ` tmoran
replies disabled

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