22
33CodeTracking is a minimal package designed to work with (a future version of)
44[ Revise.jl] ( https://github.com/timholy/Revise.jl ) .
5- Its main purpose is to allow packages that need to know the location
5+ Its main purpose is to support packages that need to know the location
66(file and line number) of code that might move around as it's edited.
77
88CodeTracking is a very lightweight dependency.
99
10- Demo :
10+ Example :
1111
1212``` julia
1313julia> using CodeTracking
@@ -16,5 +16,31 @@ julia> m = @which sum([1,2,3])
1616sum (a:: AbstractArray ) in Base at reducedim. jl: 648
1717
1818julia> file, line = whereis (m)
19- (" /home/tim/src/julia-1/usr/share/julia/base/reducedim.jl" , 648 )
19+ (" /home/tim/src/julia-1/usr/share/julia/base/reducedim.jl" , 642 )
2020```
21+
22+ In this (ficticious) example, ` sum ` moved because I deleted a few lines higher in the file;
23+ these didn't affect the functionality of ` sum ` (so we didn't need to redefine and recompile it),
24+ but it does change the starting line number of the file at which this method appears.
25+
26+ ## A few details
27+
28+ CodeTracking won't do anything * useful* unless the user is also running Revise,
29+ because Revise will be responsible for updating CodeTracking's internal variables.
30+ (Using ` whereis ` as an example, CodeTracking will just return the
31+ file/line info in the method itself if Revise isn't running.)
32+
33+ However, Revise is a fairly large (and fairly complex) package, and currently it's not
34+ easy to discover how to extract particular kinds of information from its internal storage.
35+ CodeTracking will be designed to be the new "query" part of Revise.jl.
36+ The aim is to have a very simple API that developers can learn in a few minutes and then
37+ incorporate into their own packages; its lightweight nature means that they potentially gain
38+ a lot of functionality without being forced to take a big hit in startup time.
39+
40+ ## Current state
41+
42+ Currently this package is just a stub---it doesn't do anything useful,
43+ but neither should it hurt anything.
44+ Candidate users may wish to start ` import ` ing it and then file issues
45+ or submit PRs as they discover what kinds of functionality they need
46+ from CodeTracking.
0 commit comments