On 28-Aug-2013 10:05, Johan Engelen wrote:
When doing a unit conversion, you don't want to write the function that does the unit conversion? But it *is* ok to write "in2px()" ?
It is a trade off, with in2px being close or at the minimal unambiguous representation of the action of the method. "in2px" says what happens, and it hides all other details. The next programmer who sees the code, will not need to refer to the manual to determine the direction of the conversion.
I still maintain that my original suggestion was the proper course of action. Roll back 12471, add its implementation of the new convert code, which is just a couple of files, then cause that code to be used elsewhere in the existing, unmodified code, by changing the pre-12471 include file like this
#define PX_PER_MM Inkscape::Util::Quantity::convert(1, "mm", "px")
and so forth. That way convert() is available, but adding it does not result in the needless modification of 40 something other files, making every one of them more difficult to read and less clear than the originals (IMO).
David Mathog mathog@...1176... Manager, Sequence Analysis Facility, Biology Division, Caltech