Would a"def-" macro for private varibales make sense?

1,326 views
Skip to first unread message

Goldritter

unread,
Jun 30, 2012, 7:49:36 AM6/30/12
to clo...@googlegroups.com
For functions I have a "defn" macro to create public functions and a "defn-" macro to define private functions.
For variables I have only "def". Would it make sense to also have a "def" macro for public variables and a "def-" macro for private variables, also variables which can be only accessed from within the namespace?


Ambrose Bonnaire-Sergeant

unread,
Jun 30, 2012, 8:45:28 AM6/30/12
to clo...@googlegroups.com
This topic has come up before. The conclusion from people of authority is that clojure.core is not the place for this macro, but may be appropriate for some other library.

Thanks,
Ambrose

On Sat, Jun 30, 2012 at 7:49 PM, Goldritter <marcus.goldr...@googlemail.com> wrote:
For functions I have a "defn" macro to create public functions and a "defn-" macro to define private functions.
For variables I have only "def". Would it make sense to also have a "def" macro for public variables and a "def-" macro for private variables, also variables which can be only accessed from within the namespace?



--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Vinzent

unread,
Jun 30, 2012, 10:30:08 AM6/30/12
to clo...@googlegroups.com
It's better to use ^:private metadata on the symbol naming the var, since there is also defmacro, defmulti, etc, which not have hyphened versions too.

суббота, 30 июня 2012 г., 17:49:36 UTC+6 пользователь Goldritter написал:

Sean Corfield

unread,
Jun 30, 2012, 2:12:27 PM6/30/12
to clo...@googlegroups.com
On Sat, Jun 30, 2012 at 7:30 AM, Vinzent <ru.vi...@gmail.com> wrote:
> It's better to use ^:private metadata on the symbol naming the var, since
> there is also defmacro, defmulti, etc, which not have hyphened versions too.

It seemed to be consensus that defn- was probably not a good idea but
was too common to remove...
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)
Reply all
Reply to author
Forward
0 new messages