Bug 33016 - MKMapRect.Intersection, Union, and Intersects could be instance methods.
Summary: MKMapRect.Intersection, Union, and Intersects could be instance methods.
Status: CONFIRMED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll (show other bugs)
Version: master
Hardware: PC Mac OS
: Low enhancement
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-08-12 13:24 UTC by Larry O'Brien
Modified: 2015-08-12 14:07 UTC (History)
2 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Larry O'Brien 2015-08-12 13:24:28 UTC
MKMapRect.Intersection Union and Intersect take two MKMapRects, but could be instance methods on the first instance.
Comment 1 Sebastien Pouliot 2015-08-12 14:07:13 UTC
In theory: yes. In practice: there are drawbacks as the existing API are direct binding of Apple's functions, e.g.

> MKMapRect MKMapRectIntersection ( MKMapRect rect1, MKMapRect rect2 );

which returns a new instance of MKMapRect.

Now we could copy the returned  `MKMapRect` instance values back into `this` but this has a performance impact.

It could be minor in some cases, e.g. when the original value is not needed, unless it's used in a loop.

OTOH if misused,  e.g. if the code keeps it's own copies of the `MKMapRect` because it's not aware that the other API, then you end up doing many copy operations (and likely extra allocations).

Since those API would be easier to discover (code completion) and we cannot assume everyone will read the documentation (the name pretty much covers it) then I'm not sure we end up helping a lot.


Note: `MKMapRectIntersectsRect` is different as it returns a `bool` so there would not be any impact in adding an instance method.

Note You need to log in before you can comment on or make changes to this bug.