On 27-Aug-2013 18:56, Matthew Petroff wrote:
On Tue, Aug 27, 2013 at 7:06 PM, mathog <mathog@...1176... [1]>
Wouldn't all the way to an object oriented programming style be:
p0 = p0.in2px();
It seems like halfway between C and C++ because it is. That syntax is used in older parts of the code that dont use the new Quantity class objects that store values with their units. Where Quantities are used [1], the syntax is:
quantity.value("in")
if one wanted the value in inches, no matter what unit the quantity was in. This syntax doesnt work with older sections of code without extensive rewrites, as the older sections store everything as regular floating point numbers, not objects.
Sure, but could one not put something like this (exact syntax is probably off, I did not try to compile it, and the conversion might be backwards) into src/2geom/Point.h
Point in2px const { return Point(Inkscape::convert_unit(_pt[X],"px", "in"),Inkscape::convert_unit(_pt[Y],"px", "in")); }
to implement:
p0 = p0.in2px();
What I'm getting at is that when I am maintaining code the last thing I want to see is low level plumbing, like convert_unit, the exact function being used to convert units. The desired level of abstraction was present before 12471, with PX_PER_IN and friends. Most of those were expanded by the preprocessor into fairly long expressions, none of which I cared about, and none of which were exposed to the programmer. Replacing the old include file method with convert_unit() is fine, but I _still_ don't want or need to see those details, and I especially do not want to burn >20 characters per unit change instance on each source code line.
Regards,
David Mathog mathog@...1176... Manager, Sequence Analysis Facility, Biology Division, Caltech