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

Group
 
 

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

Submitter:  julian <julian_>
Submitted:  Thu 03 Nov 2011 11:12:28 PM UTC
   
 
Category:  Base/Foundation Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group 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>
Group 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_>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-11-04 CaS StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code