From: "Jerry" <lanceboyle@qwest.net>
Subject: Re: Why does this work? (overloads)
Date: 6 Feb 2007 23:07:36 -0800
Date: 2007-02-06T23:07:36-08:00 [thread overview]
Message-ID: <1170832056.546904.122390@s48g2000cws.googlegroups.com> (raw)
In-Reply-To: <mailman.78.1170830705.18371.comp.lang.ada@ada-france.org>
On Feb 6, 11:45 pm, "Grein, Christoph (Fa. ESG)"
<Christoph.Gr...@eurocopter.com> wrote:
> > H := 1.0 + f * x; -- Adds scalar, 1.0, to a vector using my overload
> > above.
> > a := 1.0 + f * x; -- Adds scalar, 1.0, to another scalar, an inner
> > product.
>
> This feature is called overloading.
>
> For a problematic example, consider X := A*B*C; where all four are
> vectors.
>
> Is it (A*B) inner product * C resulting in vector or
> (A*B) vector * C resulting in vector.
> The compiler can't tell and will reject the code.
Hmm.... You're right, of course. Plus, (A*B) matrix * C where A*B is
taken as an outer product. The compiler did reject it, so at least
(with this example) I can't generate incorrect results, but I have to
tweak my code.
I wish that I could define new operators. I suppose there's always the
ugly:
type Math_Operator is ('+', '-', '*', '/');
function el(Left : Real_Vector; op : Math_Operator; Right :
Real_Vector) return Real_Vector is
Jerry
next prev parent reply other threads:[~2007-02-07 7:07 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 [this message]
2007-02-07 7:26 ` 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
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