Version 1.1 of acs/ac-00204.txt

Unformatted version of acs/ac-00204.txt version 1.1
Other versions for file acs/ac-00204.txt

!standard 12.3(5)          10-10-22 AC95-00204/01
!class confirmation 10-10-22
!status received no action 10-10-22
!status received 10-07-19
!subject Bad parameter name for Solve

!topic Bad choice of parameter name for Solve (A : <matrix_type>; X : <vector/matrix_type>)
!reference Ada 2005 RMG.3.1(24/2)
!from Gustaf Thorslund 10-07-16
!keywords numerics, parameter name, equations !discussion

I have been looking at Numerics packages in Ada05 and find the parameter name
'X' for Solve a bit confusing.

Usually 'X' is the unknown in an equation like A*x = b. Using those variable
names when calling Solve would result in:

A : Real_Matrix;
B, X : Real_Vector;

-- set A and B to something, then find X

X := Solve (A => A; X => B);

I have looked at 24/2 in:

The matrix notation with 'X' as unknown and A and b/B as known is the one I
learned at university and is also what is described at:

Was it intentional to use 'X' as parameter?

Is it possible to change the parameter name to for example 'B' instead?


From: Randy Brukardt
Sent: Thursday, October 21, 2010  12:13 AM

Single character parameter names are almost always a mistake. (We just had a
lengthy discussion on this on the ARG mailing list in the context of another
AI.) Operators in Ada use "Left" and "Right" for a reason. But whether or not it
was intentional in this case is irrelevant at this point.

As you know, the parameter names of Ada subprograms are visible to Ada
programmers, and can be visible in calls via named notation. Changing the name
of the parameter would be incompatible with any existing code that uses the
current parameter name in named notation (as you did in your example). As such,
we would consider changing a parameter name in a predefined library it only in
extreme cases (and I don't think we've ever had one of these).

This is surely not an extreme case. So the answer to your second question is


Questions? Ask the ACAA Technical Agent