Skip to content
This repository has been archived by the owner on Jan 28, 2019. It is now read-only.

Add *line* and *column* #52

Merged
merged 3 commits into from
Feb 3, 2016
Merged

Add *line* and *column* #52

merged 3 commits into from
Feb 3, 2016

Conversation

arrdem
Copy link
Collaborator

@arrdem arrdem commented Feb 3, 2016

Fixes #51

This changeset adds the dynamic variables clojure.core/*line* and
clojure.core/*column*. These variables are bound to be the line/column
of the top level form currently being compiled and evaluated. That is
the scope of a binding of these vars is the macroexpansion and
evaluation of that top level form.

So, for instance:

;; fn decl, does nothing
(defn foo []
  (printf "Debugging... %s:%d:%d\n" *file* *line* *column*))

;; top level form
(foo)
;; compiles to
;; (.invoke (fn* [] (foo)))
;; evaluates with *line* 5, *column* 0
;; prints "Debugging... NO_FILE:5:0\n"

These Vars are handy for generating warning messages eg. in the ns
macro which refer to the line, column and file of the top level form as
well as in writing debugging macros which otherwise have to use form
metadata introspection to extract this information which could be easily
exposed.

@arrdem arrdem reopened this Feb 3, 2016
arrdem added a commit that referenced this pull request Feb 3, 2016
@arrdem arrdem merged commit 462c6c0 into develop Feb 3, 2016
@arrdem arrdem deleted the feature/line-var branch February 3, 2016 21:06
arrdem added a commit that referenced this pull request Feb 3, 2016
This patch makes use of the line, column vars from #52 to provide
position information for deprecated refer warnings.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant