Clojure

adds docstring support to defonce

Details

  • Type: Enhancement Enhancement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: Release 1.5
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Patch:
    Code and Test
  • Approval:
    Vetted

Description

Pass all args from defonce on to def so it supports docstrings (or potentially other future features) just like def.

Docstrings and other Var metadata will be lost when the defonce is reƫvaluated.

Patch: clj-1148-defonce-3.patch

Screened by: Stuart Sierra

  1. 0001-new-defonce-hotness.patch
    17/Jan/13 5:16 PM
    1 kB
    Joe Gallo
  2. clj-1148-defonce-2.patch
    29/Dec/13 10:24 PM
    3 kB
    Alex Miller
  3. clj-1148-defonce-3.patch
    10/Jan/14 5:04 PM
    3 kB
    Alex Miller
  4. clj-1148-defonce-4.patch
    28/Aug/14 12:08 PM
    3 kB
    Linus Ericsson
  5. clj-1148-defonce-4.patch
    28/Aug/14 12:07 PM
    3 kB
    Linus Ericsson
  6. clj-1148-defonce-5.patch
    28/Aug/14 12:30 PM
    3 kB
    Linus Ericsson
  7. clj-1148-defonce-6.patch
    09/Sep/14 4:27 AM
    1 kB
    Linus Ericsson
  8. defonce_fixes.patch
    24/Oct/13 12:44 PM
    3 kB
    Joe Gallo

Activity

Alex Miller made changes -
Field Original Value New Value
Issue Type Enhancement [ 4 ] Defect [ 1 ]
Alex Miller made changes -
Approval Triaged [ 10120 ]
Alex Miller made changes -
Labels docstring
Rich Hickey made changes -
Approval Triaged [ 10120 ] Vetted [ 10003 ]
Fix Version/s Release 1.6 [ 10157 ]
Stuart Halloway made changes -
Assignee Stuart Halloway [ stu ]
Stuart Halloway made changes -
Approval Vetted [ 10003 ] Incomplete [ 10006 ]
Joe Gallo made changes -
Attachment defonce_fixes.patch [ 12388 ]
Alex Miller made changes -
Approval Incomplete [ 10006 ] Vetted [ 10003 ]
Alex Miller made changes -
Description Two issues here:

1) defonce doesn't support docstrings, although def does, so it would be nice to bring the two in line with each other

2) defonce can stomp metadata, like this:

(defonce ^:private foo 5)
#'user/foo
(meta #'foo) --> the private is there
(defone foo 10)
foo is still 5
(meta #'foo) --> the private has been lost
Two issues here:

1) defonce doesn't support docstrings, although def does, so it would be nice to bring the two in line with each other

2) defonce can stomp metadata, like this:

(defonce ^:private foo 5)
#'user/foo
(meta #'foo) --> the private is there
(defone foo 10)
foo is still 5
(meta #'foo) --> the private has been lost

*Patch:* defonce_fixes.patch
*Screened by:*
Alex Miller made changes -
Approval Vetted [ 10003 ] Screened [ 10004 ]
Description Two issues here:

1) defonce doesn't support docstrings, although def does, so it would be nice to bring the two in line with each other

2) defonce can stomp metadata, like this:

(defonce ^:private foo 5)
#'user/foo
(meta #'foo) --> the private is there
(defone foo 10)
foo is still 5
(meta #'foo) --> the private has been lost

*Patch:* defonce_fixes.patch
*Screened by:*
Two issues here:

1) defonce doesn't support docstrings, although def does, so it would be nice to bring the two in line with each other

2) defonce can stomp metadata, like this:

(defonce ^:private foo 5)
#'user/foo
(meta #'foo) --> the private is there
(defone foo 10)
foo is still 5
(meta #'foo) --> the private has been lost

*Patch:* defonce_fixes.patch
*Screened by:* Alex Miller
Assignee Stuart Halloway [ stu ]
Rich Hickey made changes -
Issue Type Defect [ 1 ] Enhancement [ 4 ]
Rich Hickey made changes -
Approval Screened [ 10004 ] Incomplete [ 10006 ]
Alex Miller made changes -
Patch Code [ 10001 ] Code and Test [ 10002 ]
Approval Incomplete [ 10006 ] Vetted [ 10003 ]
Description Two issues here:

1) defonce doesn't support docstrings, although def does, so it would be nice to bring the two in line with each other

2) defonce can stomp metadata, like this:

(defonce ^:private foo 5)
#'user/foo
(meta #'foo) --> the private is there
(defone foo 10)
foo is still 5
(meta #'foo) --> the private has been lost

*Patch:* defonce_fixes.patch
*Screened by:* Alex Miller
Pass all args from {{defonce}} on to {{def}} so it supports docstrings (or potentially other future features) just like def.

*Patch:* clj-1148-defonce-2.patch
*Screened by:*
Attachment clj-1148-defonce-2.patch [ 12569 ]
Summary adds docstring support to defonce, and stops it from stomping existing metadata adds docstring support to defonce
Stuart Sierra made changes -
Approval Vetted [ 10003 ] Incomplete [ 10006 ]
Alex Miller made changes -
Approval Incomplete [ 10006 ] Vetted [ 10003 ]
Description Pass all args from {{defonce}} on to {{def}} so it supports docstrings (or potentially other future features) just like def.

*Patch:* clj-1148-defonce-2.patch
*Screened by:*
Pass all args from {{defonce}} on to {{def}} so it supports docstrings (or potentially other future features) just like def.

*Patch:* clj-1148-defonce-3.patch
*Screened by:*
Attachment clj-1148-defonce-3.patch [ 12692 ]
Stuart Sierra made changes -
Approval Vetted [ 10003 ] Screened [ 10004 ]
Description Pass all args from {{defonce}} on to {{def}} so it supports docstrings (or potentially other future features) just like def.

*Patch:* clj-1148-defonce-3.patch
*Screened by:*
Pass all args from {{defonce}} on to {{def}} so it supports docstrings (or potentially other future features) just like def.

Docstrings and other Var metadata will be lost when the {{defonce}} is reëvaluated.

*Patch:* clj-1148-defonce-3.patch

*Screened by:* Stuart Sierra
Rich Hickey made changes -
Approval Screened [ 10004 ] Incomplete [ 10006 ]
Alex Miller made changes -
Approval Incomplete [ 10006 ] Vetted [ 10003 ]
Fix Version/s Release 1.6 [ 10157 ]
Linus Ericsson made changes -
Attachment clj-1148-defonce-4.patch [ 13270 ]
Linus Ericsson made changes -
Attachment clj-1148-defonce-4.patch [ 13271 ]
Linus Ericsson made changes -
Comment [ uses resolve to find an already defined var. includes the tests from clj-1148-defonce-3.patch ]
Linus Ericsson made changes -
Comment [ This version looks for previously defined var with resolve. A repeated defonce won't affect the namespace at all if the variable is already defined and bounded.

Please confirm using (resolve '~name) is not a problem w.r.t *ns*-bindings or similar.

This patch also contains the tests from clj-1148-defonce-3.patch as well as the :arglists property.

]
Linus Ericsson made changes -
Attachment clj-1148-defonce-5.patch [ 13272 ]
Linus Ericsson made changes -
Attachment clj-1148-defonce-6.patch [ 13321 ]

People

Vote (4)
Watch (3)

Dates

  • Created:
    Updated: