replacement of short functions by their definitions andother code cleanups
Subject: replacement of short functions by their definitions andother code cleanups
From: Andreas Eder
Date: Sat, 05 May 2007 17:14:59 +0200
Viktor wrote:
> Dear Andreas,
>
> You're right, you indeed did not replace function calls with their
> (original) definitions; however, you did replace calls to short convenience
> functions with explicit code.
Right, to make it clearer what happens.
>
> My concern, apart from subtle differences between the old and new
> implementation that requires thorough retesting of the tensor code (I don't
> mind that; if the changes were otherwise warranted, this is what we're here
> for) is that changes like this example:
>
> - (setq dumx (concat $idummyx n))
> + (setq dumx (intern (format nil "~a~d" $idummyx n)))
>
> do not make the code more readable. On the contrary, whereas before,
> subtleties of concat notwithstanding, I immediately understood that the code
> was concatenating $idummyx and n to form a symbol for dummy indices, now I
> do need to go and look up what the devil format does when its first argument
> is nil, the definition of the a and d tags in the format string, and the
> meaning of the intern function which is not at all evident from
> its name.
These are all standard common lisp functions with clear semantics.
> It also makes debugging harder, since the functionality is no longer
> encapsulated in a (separately tested) function; now, when I am hunting for
> subtle bugs, I need to explicitly test if the arguments to format are
> correct, if format returns what I expect it to return, if intern does with
> it what it is supposed to do.
There is no need to test format or intern, since they are standard
functions.
Probably the whole thing should be replaced with a call to
gentemp, because that is what it is trying to do - generate a
unique symbol, isn't it?
As this issue is obviously a sensitive one I will refrain from
making such changes in the future. (And ask on the list before
- I didn't think it would be such a big thing).
'Andreas