Clojure

Improve clojure.repl/dir-fn to work on namespace aliases in addition to canonical namespaces.

Details

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

Description

Extend clojure.repl/dir to work with the aliases in the current namespace

After:

user=> (require '[clojure.string :as s])
nil
user=> (dir s)
blank?
capitalize
...etc

Patch: clj-1673-3.patch

Screened by: Alex Miller

  1. clj-1673-2.patch
    04/May/15 4:38 PM
    2 kB
    Alex Miller
  2. clj-1673-3.patch
    13/Oct/15 1:06 PM
    2 kB
    Jason Whitlark
  3. improve_dir.patch
    02/May/15 10:35 PM
    2 kB
    Jason Whitlark

Activity

Alex Miller made changes -
Field Original Value New Value
Labels enhancement repl
Alex Miller made changes -
Description I've always been frustrated that you couldn't use clojure.repl/dir with the aliases you define in your namespace. There doesn't seem to be any reason why you couldn't look for a symbol via ns-aliases.

This does introduce a dependency on *ns*, but only for looking up aliases. If no alias is found, behavior is the same as the current implementation.

Patch is included, feel free to use it or change it as needed. I'm not sure as to the best way to test this.

FYI: I've signed the CA.

~Jason Whitlark
Extend clojure.repl/dir to work with the aliases in the current namespace

*Patch:* improve_dir.patch

*Question:* This does introduce a dependency on \*ns*, but only for looking up aliases. If no alias is found, behavior is the same as the current implementation.
Approval Triaged [ 10120 ]
Alex Miller made changes -
Priority Trivial [ 5 ] Minor [ 4 ]
Jason Whitlark made changes -
Attachment improve_dir.patch [ 14102 ]
Jason Whitlark made changes -
Attachment improve_dir.patch [ 13928 ]
Alex Miller made changes -
Description Extend clojure.repl/dir to work with the aliases in the current namespace

*Patch:* improve_dir.patch

*Question:* This does introduce a dependency on \*ns*, but only for looking up aliases. If no alias is found, behavior is the same as the current implementation.
Extend clojure.repl/dir to work with the aliases in the current namespace

After:
{code}
user=> (require '[clojure.string :as s])
nil
user=> (dir s)
blank?
capitalize
...etc
{code}

*Patch:* improve_dir.patch
*Screened by:* Alex Miller
Alex Miller made changes -
Labels repl ft repl
Jason Whitlark made changes -
Patch Code [ 10001 ] Code and Test [ 10002 ]
Alex Miller made changes -
Attachment clj-1673-2.patch [ 14124 ]
Description Extend clojure.repl/dir to work with the aliases in the current namespace

After:
{code}
user=> (require '[clojure.string :as s])
nil
user=> (dir s)
blank?
capitalize
...etc
{code}

*Patch:* improve_dir.patch
*Screened by:* Alex Miller
Extend clojure.repl/dir to work with the aliases in the current namespace

After:
{code}
user=> (require '[clojure.string :as s])
nil
user=> (dir s)
blank?
capitalize
...etc
{code}

*Patch:* clj-1673-2.patch
*Screened by:* Alex Miller
Rich Hickey made changes -
Fix Version/s Release 1.8 [ 10254 ]
Approval Triaged [ 10120 ] Vetted [ 10003 ]
Alex Miller made changes -
Approval Vetted [ 10003 ] Screened [ 10004 ]
Rich Hickey made changes -
Approval Screened [ 10004 ] Ok [ 10007 ]
Alex Miller made changes -
Approval Ok [ 10007 ] Incomplete [ 10006 ]
Jason Whitlark made changes -
Attachment clj-1673-3.patch [ 15215 ]
Alex Miller made changes -
Approval Incomplete [ 10006 ] Vetted [ 10003 ]
Alex Miller made changes -
Fix Version/s Release 1.9 [ 10750 ]
Fix Version/s Release 1.8 [ 10254 ]
Alex Miller made changes -
Description Extend clojure.repl/dir to work with the aliases in the current namespace

After:
{code}
user=> (require '[clojure.string :as s])
nil
user=> (dir s)
blank?
capitalize
...etc
{code}

*Patch:* clj-1673-2.patch
*Screened by:* Alex Miller
Extend clojure.repl/dir to work with the aliases in the current namespace

After:
{code}
user=> (require '[clojure.string :as s])
nil
user=> (dir s)
blank?
capitalize
...etc
{code}

*Patch:* clj-1673-3.patch

Alex Miller made changes -
Description Extend clojure.repl/dir to work with the aliases in the current namespace

After:
{code}
user=> (require '[clojure.string :as s])
nil
user=> (dir s)
blank?
capitalize
...etc
{code}

*Patch:* clj-1673-3.patch

Extend clojure.repl/dir to work with the aliases in the current namespace

After:
{code}
user=> (require '[clojure.string :as s])
nil
user=> (dir s)
blank?
capitalize
...etc
{code}

*Patch:* clj-1673-3.patch

*Screened by:* Alex Miller
Approval Vetted [ 10003 ] Screened [ 10004 ]
Rich Hickey made changes -
Approval Screened [ 10004 ] Ok [ 10007 ]
Stuart Halloway made changes -
Status Open [ 1 ] Closed [ 6 ]
Resolution Completed [ 1 ]

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: