Clojure

pprint: logical-block macro uses private vars

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: Release 1.2
  • Component/s: None
  • Labels:
    None
  • Approval:
    Ok

Description

Alex Ott noticed that the logical-block macro that's used to build dispatch tables uses two vars and a function that are private to clojure pprint. This makes it more difficult for programmers to build custom dispatch.

Activity

Hide
Assembla Importer added a comment -

tomfaulhaber said: [file:clc8hqEl4r35dfeJe5cbCb]: Access private vars correctly

Show
Assembla Importer added a comment - tomfaulhaber said: [file:clc8hqEl4r35dfeJe5cbCb]: Access private vars correctly
Hide
Assembla Importer added a comment -

tomfaulhaber said: This patch will use the #'ns/var idiom to access the private vars from the macro. It's a little tricky because binding doesn't seem to support that idiom, so we use push-thread-bindings directly.

Show
Assembla Importer added a comment - tomfaulhaber said: This patch will use the #'ns/var idiom to access the private vars from the macro. It's a little tricky because binding doesn't seem to support that idiom, so we use push-thread-bindings directly.
Hide
Assembla Importer added a comment -

stu said: I have two questions for Rich:

1. I have hit the same issue with binding a private var. Is this approach idiomatic?

2. The patch uses var-get. What's the difference between var-get and deref? They follow a different code path in Var.java.

Patch works, and unless the answer to #1 or #2 is a problem this patch looks good.

Show
Assembla Importer added a comment - stu said: I have two questions for Rich: 1. I have hit the same issue with binding a private var. Is this approach idiomatic? 2. The patch uses var-get. What's the difference between var-get and deref? They follow a different code path in Var.java. Patch works, and unless the answer to #1 or #2 is a problem this patch looks good.
Hide
Assembla Importer added a comment -

richhickey said: 1) yes
2) get has a slight optimization

Show
Assembla Importer added a comment - richhickey said: 1) yes 2) get has a slight optimization
Hide
Assembla Importer added a comment -

stu said: Updating tickets (#381, #386, #388, #391, #377)

Show
Assembla Importer added a comment - stu said: Updating tickets (#381, #386, #388, #391, #377)

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: