Boost logo

Boost :

Subject: Re: [boost] [geometry] area, length, centroid, behavior
From: Barend Gehrels (barend_at_[hidden])
Date: 2009-02-26 16:33:02


>>>
>>> I also want to reiterate that area(point) and length(polygon) should be syntax errors. Type safety isn't something we should break lightly.
>>>
>>>
In your previous reaction you gave the example:
> Polygon p1;
> //lots of code
> if(some condition) {
> Point p1;
> //some more code
> result = something + area(p1); //oops, which p1 did they mean? Is it really so unlikely?
> }
>
I agree that such typo's are possible. But why would they only occur for
area and length? What about other (generic) operations? Then the syntax
error would of course not be found by the compiler.

We're building a generic library, where all algorithms apply to all
geometries as much as possible. We should not exclude possibilities just
because the risk of a typo in implementation. I assume that you have
algorithms operating on more than one geometry type alone. Area is not
an exception.

Regards, Barend


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk