Skip to content

Kibit breaks on namespace qualified keywords #14

Open
ghoseb opened this Issue Mar 10, 2012 · 7 comments

5 participants

@ghoseb
ghoseb commented Mar 10, 2012

If the code contains namespace qualified keywords with aliases, Kibit errors out with a Invalid token exception.

The following code demonstrates the problem -

;;; foo.clj
(ns foo)

;;; bar.clj
(ns bar
  (:require [foo :as f]))

(defn xxx []
    ::f/some-kwd)

I think the problem is not in Kibit itself but the way it's invoking the Clojure compiler.

@jonase
Owner
jonase commented Mar 10, 2012

::f/some-kwd is not valid clojure syntax:

user=> ::f/some-kwd
java.lang.Exception: Invalid token: ::f/some-kwd
@ghoseb
ghoseb commented Mar 10, 2012

jonase - Indeed, ::f/some-kwd is valid if f is a valid ns/alias.

user> (ns foobar)
nil
foobar> (ns user)
nil
user> ::foobar/some-kwd
:foobar/some-kwd
user> ::fubar/some-kwd
; Evaluation aborted.
user> 
@jonase
Owner
jonase commented Mar 12, 2012

@ghoseb You're right -- it is valid syntax. I had never seen it before :)

It seems like we have to load the file prior to reading it. Some more discussion here.

@ghoseb
ghoseb commented Mar 12, 2012

@jonase I am following the discussion on the list. Indeed, :: is a dynamic feature and hence loading the file might be necessary in order to get this working.

Is loading the file and option for you?

@ohpauleez ohpauleez was assigned Mar 13, 2012
@ohpauleez
Collaborator

@ghoseb Currently, we can't do a work-around without eval'ing the whole file, which is strictly not "static". I have some weird hacks to try to get around this, but none are working out too well. Currently on master, there's a try/catch for this (which will be present in the next release that gets cut).

When we have a better solution, we'll put one in for sure. As always, we welcome any idea.

@alexander-yakushev

Bump. I've just run into this as well. :)

@scstarkey

Me, too. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.