Clojure

Automatic type translation from Integer to Long

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: Release 1.3
  • Component/s: None
  • Labels:
    None

Description

In some cases types can get lost:

(def i1 (Integer. "100"))
(def i2 (Integer/valueOf 100))

[(class i1) (class i2)]
==> [java.lang.Integer java.lang.Long]

;; expected ==> [java.lang.Integer java.lang.Integer]

;; But: (class (Integer/valueOf 100)) ==> java.lang.Integer

Works correspondingly for Floats, which become Doubles.

Activity

Hide
Assembla Importer added a comment -

richhickey said: (In [[r:cc8372f12074b4cccbdd9cde3cfacfae069c57d3]]) don't coerce pre-boxed Integers and Floats to Longs/Doubles, fixes #439

Branch: master

Show
Assembla Importer added a comment - richhickey said: (In [[r:cc8372f12074b4cccbdd9cde3cfacfae069c57d3]]) don't coerce pre-boxed Integers and Floats to Longs/Doubles, fixes #439 Branch: master
Hide
Assembla Importer added a comment -
Show
Assembla Importer added a comment - Converted from http://www.assembla.com/spaces/clojure/tickets/439

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: