Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 840709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:40:12+00:00 2026-05-15T05:40:12+00:00

Should I feel wary about creating clojure keywords which have non-existent namespaces? An example

  • 0

Should I feel wary about creating clojure keywords which have non-existent namespaces?

An example would be :foo/bar, where namespace foo doesn’t actually exist. This seems to be possible because these keywords behave like literals. I couldn’t find any problems doing this in the REPL, but I’m concerned about possible problems with AOT compilation.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T05:40:13+00:00Added an answer on May 15, 2026 at 5:40 am

    A namespace will in fact not be created simply because a keyword or symbol is encountered which would “belong” to it, as the following interaction at a fresh REPL illustrates:

    ; SLIME 2010-05-06
    user> (-> (.getNamespace :user/foo) symbol)
    user
    user> (-> (.getNamespace :user/foo) symbol the-ns)
    #<Namespace user>
    user> (-> (.getNamespace :bar/foo) symbol the-ns)
    ; java.lang.Exception: No namespace: bar found
    

    However, this is no cause for worry. A keyword’s or symbol’s “namespace” field is just an interned string; there is no reference back to the corresponding namespace object involved even if one exists. In fact, as can be seen above, the .getNamespace method of keywords and symbols returns a string and one has to jump a few hops to get to the actual namespace from that.

    Trying to resolve a namespace-qualified symbol with the resolve function is safe too. That’s regardless of whether the namespace actually exists; if it doesn’t, nil is returned, as in the case where it does exist, but holds no Var of the given name. ns-resolve, in contrast, will throw an exception like the one mentioned in the snippet from the REPL above if it can’t find the given namespace.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have what I feel should be a simple question. I have been trying
I have a computational geometry problem that I feel should have a relatively simple
I have two eclipse projects on an SVN repository that I feel should be
This is a dangerously easy thing I feel I should know more about -
Should I feel bad about leaving out the -khtml- prefix from css attributes like
I'm attempting something which I feel should be fairly obvious to me but it's
This is an interesting problem I've come across that I feel should have an
I have a simple problem, and one I feel should be almost trivial. I
I have some very small classes that I feel should be pulled up but
I hope it's Monday-itis kicking in at the moment, but something I feel should

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.