[geos-devel] Issue with returning Coordinate * rather than value

Martin Davis mbdavis at VividSolutions.com
Thu Nov 14 19:48:19 EST 2002


One concern I have with the idea of changing all getCoordinate calls to return a ref rather than a value is this kills immutability of Geometrys.  Clients can change Coordinates without the Geometry knowing about it, which could result in internal errors.  JTS does currently allow this as well, but I'm not too happy about it.  In C++ we have the opportunity to easily make this secure, which might be nice to take advantage of.

What do people think - is security more important than performance?

Is there a way to have both, perhaps by having a Coordinate* function only available to friends of the CoordinateList class?



Martin Davis, Senior Technical Specialist
Vivid Solutions Inc.
Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5
Phone: (250) 385 6040    Fax: (250) 385 6046
EMail: mbdavis at vividsolutions.com  Web: www.vividsolutions.com





More information about the geos-devel mailing list