bugGNUstep - Bugs: bug #34744, [NSDate timeIntervalSinceDate:nil]...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #34744: [NSDate timeIntervalSinceDate:nil] throws an exception

Submitted by:  julian <julian_>
Submitted on:  Thu 03 Nov 2011 11:12:28 PM UTC  
 
Category: Base/FoundationSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Mon 07 Nov 2011 11:53:18 AM UTC, comment #4:

great, thanks.

btw here is (a copy of) the bugreport sent to apple with the request to document the behavior:

http://openradar.appspot.com/radar?id=1428401

julian <julian_>
Fri 04 Nov 2011 09:04:19 PM UTC, comment #3:

I updated this method

Richard Frith-Macdonald <CaS>
Project Member
Fri 04 Nov 2011 10:32:24 AM UTC, comment #2:

i'm not sure here as well.

throwing an exception sounds like the saner thing to do.

on the other hand, this difference increases the porting effort from cocoa, e.g. in my case.

i mainly opened the bug to make you aware of the difference.

apple's documentation doesn't explicitly say they return NaN when the input is nil, but it also doesn't say that the method throws, and since, AFAIK, all throwing methods are documented, it is implicitly documented that it doesn't throw ;-)

i can open a bug with apple that they should document that they return nil, but given my experience with opening bugs with them i expect them to act somewhere between 5 years from now and never.

julian <julian_>
Fri 04 Nov 2011 06:16:30 AM UTC, comment #1:

I have a problem with this one ...

Unless you know better, the behavior for this case is simply undocumented, and OSX usual action when passed an invalid argument (and it's pretty hard to argue that passing a non-date to a method which specifically says it expects a date is anything other than an application error) is to raise an NSInvalidArgumentException.

But ... we generally try to mirror Apple's current implementation, so maybe we should simply remove the check for an invalid argument here (and replace it if necessary later if/when Apple changes OSX)?

Have you tried reporting it as a bug to Apple? Most likely they'd say the behavior is simply undefined, but they might decide to change it.

Richard Frith-Macdonald <CaS>
Project Member
Thu 03 Nov 2011 11:12:28 PM UTC, original submission:

[NSDate timeIntervalSinceDate:nil] throws an exception, but on Mac OS X this just returns NaN.

julian <julian_>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by CaS (Posted a comment)
  • -unavailable- added by julian_ (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 04 Nov 2011 09:04:19 PM UTCCaSStatusNone=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1