ClojureScript

IHash not extended to js/Date

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Declined
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

Makes for fun times, like:

cljs.user=> ((hash-map #inst "1990-01-29T00:39:33.938-00:00" 5) #inst "1990-01-29T00:39:33.938-00:00")
nil

Happy to put together a patch implementing a sane IHash impl for js/Date. Have not done so already only because js/Date does have a place in core.cljs where core protocols are being extended to host types, but IHash just isn't included; perhaps there was a reason?

Activity

Hide
Chas Emerick added a comment -

wontfix, closing. CLJS-525

Show
Chas Emerick added a comment - wontfix, closing. CLJS-525
Hide
Chas Emerick added a comment -

Opened CLJS-525 per dnolen's suggestion in irc, to allow things like this to be supported without touching built-in prototypes.

Show
Chas Emerick added a comment - Opened CLJS-525 per dnolen's suggestion in irc, to allow things like this to be supported without touching built-in prototypes.
Hide
David Nolen added a comment -

Actually we should just add Date to the list of natives that are specially handled along with object, boolean, string etc.

Show
David Nolen added a comment - Actually we should just add Date to the list of natives that are specially handled along with object, boolean, string etc.
Hide
David Nolen added a comment -

No and we will probably remove that. Our modification of the String prototype has already wrecked havoc as far as interop goes. There is simply no justification for modifying natives in core.

Show
David Nolen added a comment - No and we will probably remove that. Our modification of the String prototype has already wrecked havoc as far as interop goes. There is simply no justification for modifying natives in core.
Hide
Chas Emerick added a comment -

Didn't that ship sail already with IEquiv?

Show
Chas Emerick added a comment - Didn't that ship sail already with IEquiv?
Hide
Fogus added a comment -

> users should deal with js/Date themselves

Seconded.

Show
Fogus added a comment - > users should deal with js/Date themselves Seconded.
Hide
David Nolen added a comment -

This implies modifying the prototype of a native in core, I'm not very excited about that. I'm inclined to say that users should deal with js/Date themselves.

Show
David Nolen added a comment - This implies modifying the prototype of a native in core, I'm not very excited about that. I'm inclined to say that users should deal with js/Date themselves.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: