tools.trace

Remove unnecessary (?) (def ~name) from deftrace

Details

  • Type: Enhancement Enhancement
  • Status: Resolved Resolved
  • Priority: Trivial Trivial
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

I was working on enhancements to a lint tool and trying it out on contrib libraries to see if any of them have redefinitions of symbols. It found that every use of deftrace causes a redefinition. Looking at deftrace's definition, I cannot see any reason for the (def ~name) before the later (defn ~name ...) expression. The later expression is done unconditionally, unlike the way deftest or defmulti always def a var, then redefine it if it was unbound.

I could easily be missing something important here, but is there a reason for the (def ~name)?

Activity

Hide
Nicola Mometto added a comment -

Removing the def, (deftrace x [] #'x) wouldn't compile anymore.

What about replacing the def with a declare?

Show
Nicola Mometto added a comment - Removing the def, (deftrace x [] #'x) wouldn't compile anymore. What about replacing the def with a declare?
Hide
Luc Préfontaine added a comment -

Switched to declare. This satisfies the compiler.

Show
Luc Préfontaine added a comment - Switched to declare. This satisfies the compiler.
Hide
Luc Préfontaine added a comment -

Replaced the def by declare

Show
Luc Préfontaine added a comment - Replaced the def by declare
Hide
Luc Préfontaine added a comment -

Official release 0.7.8, bad readme in 0.7.7

Show
Luc Préfontaine added a comment - Official release 0.7.8, bad readme in 0.7.7

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: