Support for prefix lists in ns?

171 views
Skip to first unread message

Tom Locke

unread,
Feb 20, 2015, 2:48:55 AM2/20/15
to clojur...@googlegroups.com
Are prefix lists supported in ClojureScript's (ns ...)?

It seems not, unless I am misunderstanding the syntax. e.g.

(ns my.namespace (:require (foo [baa baz]))

should be equivalent to

(ns my.namespace (:require [foo.baa] [foo.baz])

but gives a compiler error "Only :as alias and :refer (names) options supported in :require"

Is this expected?

Thanks

Tom

David Nolen

unread,
Feb 20, 2015, 6:57:18 AM2/20/15
to clojur...@googlegroups.com
It's not supported. ClojureScript's ns form is a restrictive subset of the functionality provided in Clojure. This is a good thing, what's there already involves an amazing amount of complexity.

David


Tom

--
Note that posts from new members are moderated - please be patient with your first post.
---
You received this message because you are subscribed to the Google Groups "ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojurescrip...@googlegroups.com.
To post to this group, send email to clojur...@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.

Tom Locke

unread,
Feb 20, 2015, 11:38:42 AM2/20/15
to clojur...@googlegroups.com
Fair enough.

Are there any tips for reducing the size of large ns forms?

For example I have a util namespace, and I consider the functions in there part of my core vocabulary, alongside all the regular core functions and macros. I don’t want to see them with a namespace prefix in my code. Given the lack of refer :all, I end up with a long refer list which I frequently have to maintain. Is there any way around this?

Thanks

Tom

You received this message because you are subscribed to a topic in the Google Groups "ClojureScript" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojurescript/jWqMeJUYU14/unsubscribe.
To unsubscribe from this group and all its topics, send an email to clojurescrip...@googlegroups.com.

David Nolen

unread,
Feb 20, 2015, 11:51:36 AM2/20/15
to clojur...@googlegroups.com
There is no way around this.

David

Francis Avila

unread,
Feb 20, 2015, 1:26:47 PM2/20/15
to clojur...@googlegroups.com
Would you reject a patch which adds (only) prefix lists to the ns form, or is this a feature you never want to see in ClojureScript?

(Not that I'm going to rush out and write one: just want to know your stance here.)

David Nolen

unread,
Feb 20, 2015, 2:19:51 PM2/20/15
to clojur...@googlegroups.com
Further enhancements to the ns form are the very lowest priority. People can submit patches but they are unlikely to get any attention anytime soon.

David

Colin Fleming

unread,
Feb 20, 2015, 10:51:46 PM2/20/15
to clojur...@googlegroups.com
As someone who has to parse and manipulate ns forms, prefix lists are one of the most annoying things to have to deal with. They make adding and removing requires to an ns form using a minimal diff very difficult. I'd love it if Clojure adopted the more opinionated ns form of CLJS.

Stuart Sierra

unread,
Mar 3, 2015, 2:59:24 PM3/3/15
to clojur...@googlegroups.com
On Friday, February 20, 2015, Colin Fleming wrote:
> As someone who has to parse and manipulate ns forms,
> prefix lists are one of the most annoying things to
> have to deal with.

As the maintainer of tools.namespace, I agree completely. :)
Reply all
Reply to author
Forward
0 new messages