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)

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 33016 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

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.