Clojure

Add support for marker protocols

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: Release 1.5
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code and Test
  • Approval:
    Ok

Description

The attached patch adds support to marker protocols, for example

(defprotocol Sequential
"marker protocol indicating a sequential type")

Activity

Hide
Jonas Enlund added a comment -

Marker protocols are supported and used in ClojureScript.

Show
Jonas Enlund added a comment - Marker protocols are supported and used in ClojureScript.
Rich Hickey made changes -
Field Original Value New Value
Approval Vetted [ 10003 ]
Fix Version/s Release 1.5 [ 10150 ]
Fogus made changes -
Assignee Fogus [ fogus ]
Hide
Kevin Downey added a comment -

what are the uses for marker protocols? I know there are marker interfaces in java, but is it a pattern we want to carry forward?

Show
Kevin Downey added a comment - what are the uses for marker protocols? I know there are marker interfaces in java, but is it a pattern we want to carry forward?
Hide
Fogus added a comment -

Nice and simple. Tested with:

(defprotocol P (hi [_]))
(defprotocol M)
(deftype T [a] M P (hi [_] "hi there"))
(satisfies? P (T. 1))
(satisfies? M (T. 1))
(hi (T. 1))
(defprotocol M2 "marker for 2")
(extend-type T M2)
(satisfies? M2 (T. 1))

Similar tests are included in the additional patch file as test cases. This additional patch file should be applied after the feature's main patch file.

Show
Fogus added a comment - Nice and simple. Tested with:
(defprotocol P (hi [_]))
(defprotocol M)
(deftype T [a] M P (hi [_] "hi there"))
(satisfies? P (T. 1))
(satisfies? M (T. 1))
(hi (T. 1))
(defprotocol M2 "marker for 2")
(extend-type T M2)
(satisfies? M2 (T. 1))
Similar tests are included in the additional patch file as test cases. This additional patch file should be applied after the feature's main patch file.
Fogus made changes -
Approval Vetted [ 10003 ] Screened [ 10004 ]
Attachment CLJ-966-additional-marker-tests-APPLY-AFTER.diff [ 11436 ]
Assignee Fogus [ fogus ]
Rich Hickey made changes -
Approval Screened [ 10004 ] Ok [ 10007 ]
Stuart Halloway made changes -
Resolution Completed [ 1 ]
Status Open [ 1 ] Closed [ 6 ]

People

Vote (2)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: