Re: Copying (immigrating) macros from namespace to namespace

2013-01-07 Thread the80srobot
Stuart, You're right that it breaks identity. How about a different approach then - I can get the list of referred vars from a namespace, and vars can cary metadata. A natural way to add more flexibility would be to add a flag - let's call it :export - to referred vars that I'd like for

Copying (immigrating) macros from namespace to namespace

2013-01-06 Thread the80srobot
I have come up with a solution to a problem I don't think exists outside of my mind, but since I can't for the life of me figure out how Clojure 'wants' me to do this, I thought I would bounce this off the Google Group. *The scenario:* I am trying to collect a bunch of functions and macros from

Re: Copying (immigrating) macros from namespace to namespace

2013-01-06 Thread Sean Corfield
Here's what I use to pull symbols from Enlive into FW/1: (def ^:private enlive-symbols ['append 'at 'clone-for 'content 'do- 'html-content 'prepend 'remove-class 'set-attr 'substitute]) (defmacro enlive-alias ^:private [sym] `(let [enlive-sym# (resolve (symbol (str html/ ~sym)))]

Re: Copying (immigrating) macros from namespace to namespace

2013-01-06 Thread Brian Marick
On Jan 6, 2013, at 3:34 PM, Sean Corfield seancorfi...@gmail.com wrote: Here's what I use to pull symbols from Enlive into FW/1: Midje plays similar tricks to make namespace abilities available via one `use`. Which makes me think: 1: In the old patterns world, there was a rule of three

Re: Copying (immigrating) macros from namespace to namespace

2013-01-06 Thread Leonardo Borges
+1 I was thinking of doing the same in the validation lib I published recently [1] and this thread came in handy. I haven't implemented it yet but having a common way in which people do this seems reasonable - if it's in core then all the better. Cheers, Leo [1] -

Re: Copying (immigrating) macros from namespace to namespace

2013-01-06 Thread Stuart Sierra
I've said it before and I will keep saying it: copying symbols by interning vars breaks the identity of the original vars. It breaks dynamic binding, with-redefs, and the ability to redefine functions at the REPL. Clojure has a two perfectly good mechanisms for making vars available in other

Re: Copying (immigrating) macros from namespace to namespace

2013-01-06 Thread Leonardo Borges
On Mon, Jan 7, 2013 at 1:17 PM, Stuart Sierra the.stuart.sie...@gmail.com wrote: I've said it before and I will keep saying it: copying symbols by interning vars breaks the identity of the original vars. It breaks dynamic binding, with-redefs, and the ability to redefine functions at the REPL.

Re: Copying (immigrating) macros from namespace to namespace

2013-01-06 Thread Sean Corfield
On Sun, Jan 6, 2013 at 6:17 PM, Stuart Sierra the.stuart.sie...@gmail.com wrote: 1. `refer`. Define a public function that `refer`s all the symbols you want. It's an extra step for the user, but that's good because it makes it evident that extra symbols are being added. Forcing all users of a

Re: Copying (immigrating) macros from namespace to namespace

2013-01-06 Thread Vedang
I remembered bookmarking a library that did something similar, so I looked at my bookmarks. Here is Zach Tellman's potemkin library, you might be interested in checking it out: https://github.com/ztellman/potemkin From the README : Clojure’s namespaces conflate how you implement your code and