Clojure

repl/source could support protocol functions

Details

  • Type: Enhancement Enhancement
  • Status: Open Open
  • Priority: Trivial Trivial
  • Resolution: Unresolved
  • Affects Version/s: Release 1.5
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Patch:
    Code

Description

user=> (source clojure.core.protocols/coll-reduce)
Source not found

But since the protocol fn's var's metadata points to the protocol var, and the protocol var knows the file and line where it was defined, it would be trivial to improve 'source' to look like this:

user=> (source clojure.core.protocols/coll-reduce)
(defprotocol CollReduce
  "Protocol for collection types that can implement reduce faster than
  first/next recursion. Called by clojure.core/reduce. Baseline
  implementation defined in terms of Iterable."
  (coll-reduce [coll f] [coll f val]))

Activity

Chouser made changes -
Field Original Value New Value
Patch Code [ 10001 ]
Attachment 0001-Add-support-for-protocol-fns-to-repl-source.-CLJ-1088.patch [ 11592 ]
Chouser made changes -
Assignee Chouser [ chouser@n01se.net ]
Chouser made changes -
Status Open [ 1 ] In Progress [ 3 ]
Chouser made changes -
Status In Progress [ 3 ] Open [ 1 ]
Chouser made changes -
Assignee Chouser [ chouser@n01se.net ]
Alex Miller made changes -
Labels repl

People

  • Assignee:
    Unassigned
    Reporter:
    Chouser
Vote (0)
Watch (1)

Dates

  • Created:
    Updated: