Allow case statement to compare java constants

Description

As raised on the mailing list: https://groups.google.com/forum/#!topic/clojure/3yGjDO2YnjQ

It's not possible to use java constants in a case statement. condp = could be used in this case but these are things which could be used in a java switch statement and so it's annoying to give up constant time dispatch. For example:

(case (.getActionMasked event)
MotionEvent/ACTION_POINTER_DOWN :down
MotionEvent/ACTION_UP :up
MotionEvent/ACTION_POINTER_UP :up
MotionEvent/ACTION_MOVE :move
MotionEvent/ACTION_CANCEL :cancel
MotionEvent/ACTION_OUTSIDE :outside
:none))

Doesn't work, but there is no reason this couldn't be resolved at compile time and dispatched in constant time.

Environment

None

Activity

Show:
Herwig Hochleitner
March 2, 2014, 5:32 PM

Another solution for this problem: http://dev.clojure.org/jira/browse/CLJ-1368

Assignee

Unassigned

Reporter

AdamClements

Labels

Approval

None

Patch

None

Priority

Minor
Configure