Clojure

Deref throws an unhelpful error message when used on something not dereferencable

Details

  • Type: Enhancement Enhancement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Approval:
    Triaged

Description

Consider the following code:

(def x 1)
(def y (ref 2))

(+ @x y)

Clojure throws a ClassCastException on cast to Future. This is a very unhelpful error message; why a Future, why not Ref, Atom etc. It would be nice if this failed more gracefully.

  1. deref.patch
    15/Sep/14 2:08 PM
    2 kB
    Tobias Kortkamp
  2. tests-patch.diff
    17/Sep/14 5:44 AM
    1.0 kB
    Mark Nutter

Activity

Alex Miller made changes -
Field Original Value New Value
Approval Triaged [ 10120 ]
Description Consider the following code:

(def x 1)
(def y (ref 2))

(+ @x y)


Clojure throws a ClassCastException on cast to Future. This is a very unhelpful error message; why a Future, why not Ref, Atom etc. It would be nice if this failed more gracefully.
Consider the following code:

{code}
(def x 1)
(def y (ref 2))

(+ @x y)
{code}

Clojure throws a ClassCastException on cast to Future. This is a very unhelpful error message; why a Future, why not Ref, Atom etc. It would be nice if this failed more gracefully.
Issue Type Defect [ 1 ] Enhancement [ 4 ]
Alex Miller made changes -
Labels errormsgs errormsgs newbie
Tobias Kortkamp made changes -
Attachment deref.patch [ 13341 ]
Mark Nutter made changes -
Attachment clj-1436-patch-2014-09-16.diff [ 13344 ]
Mark Nutter made changes -
Attachment clj-1436-patch-2014-09-16.diff [ 13344 ]
Mark Nutter made changes -
Attachment tests-patch.diff [ 13345 ]

People

Vote (2)
Watch (1)

Dates

  • Created:
    Updated: