comp.lang.ada
 help / color / mirror / Atom feed
From: Gustaf Thorslund <gustaf@thorslund.org>
Subject: Re: X : Real_Vector := Solve(A => A, X => B); -- Why X as argument name?
Date: Mon, 24 Dec 2012 22:25:53 +0100
Date: 2012-12-24T22:25:53+01:00	[thread overview]
Message-ID: <87ip7rkuqm.fsf@katthult.thorslund.org> (raw)
In-Reply-To: lylicny8i4.fsf@pushface.org

Simon Wright <simon@pushface.org> writes:

> Niklas Holsti <niklas.holsti@tidorum.invalid> writes:
>
>> Or do you mean to ask if it was a mistake in the definition of
>> Ada.Numerics.Real_Arrays.Solve to give the second formal parameter the
>> name "X", given that "X" is a common name in client code?
>
> This is certainly a style issue. The second parameter has been 'X' ever
> since it was introduced in v4 of ai-00296 in June 2003[1]. I would
> probably have chosen 'B', but there may well be mathematical texts that
> would take the approach adopted in the ARM.

Thanks for the link! So then we are three who would have chosen 'B' over
'X'. I'm curious why 'X' was chosen. But whatever the reason was it's
already done.

> It's very common for mathematical code to adopt terse naming, in line
> with the way mathematicians seem to work, and I find it hard to think of
> sensible names for these parameters. But it ought to be possible for
> client code to be more explicit (unless, of course, the algorithm to be
> implemented was specified by one of the above-referenced mathematicians!)

When it comes to an abstract generic level it may be hard to come up
with more explicit names. A queue will have a head and tail (or some
other names). Depending on application it may be good or bad to be
first.

/Gustaf



  parent reply	other threads:[~2012-12-24 21:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-23 22:28 X : Real_Vector := Solve(A => A, X => B); -- Why X as argument name? Gustaf Thorslund
2012-12-24  8:33 ` Niklas Holsti
2012-12-24 11:50   ` Simon Wright
2012-12-24 12:58     ` Niklas Holsti
2012-12-24 21:25     ` Gustaf Thorslund [this message]
2012-12-24 20:42   ` Gustaf Thorslund
2012-12-24 20:10 ` jpwoodruff
replies disabled

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