Re: Source code as metadata

2012-04-01 Thread Phil Hagelberg
Jeff Weiss writes: > From browsing git, it looks like the project.clj version hasn't been > incremented in 7 months, and the fix for closures came in after that. > If you're using serializable.fn from a maven repo, it is out of > date, AFAICT. Sorry about that; just pushed a new 1.1.2 version wi

Re: Source code as metadata

2012-03-31 Thread Jeff Weiss
I believe the latest code does capture closures properly. I haven't tested all kinds of crazy corner cases, but it does work for all my closures. >From browsing git, it looks like the project.clj version hasn't been incremented in 7 months, and the fix for closures came in after that. If you'

Re: Source code as metadata

2012-03-31 Thread Nathan Matthews
On 31 Mar 2012, at 00:00, Cedric Greevey wrote: > On Fri, Mar 30, 2012 at 6:17 PM, Lee Spector wrote: >> >> On Mar 30, 2012, at 5:11 PM, Cedric Greevey wrote: >>> >>> That opens a giant can of worms. How, for example, do we discover that >>> (partial * 2) and #(* % 2) and (fn [x] (* 2 x)) and

Re: Source code as metadata

2012-03-30 Thread Cedric Greevey
On Fri, Mar 30, 2012 at 6:17 PM, Lee Spector wrote: > > On Mar 30, 2012, at 5:11 PM, Cedric Greevey wrote: >> >> That opens a giant can of worms. How, for example, do we discover that >> (partial * 2) and #(* % 2) and (fn [x] (* 2 x)) and #(+ %1 %1) are all >> equal? Nevermind once we get into sit

Re: Source code as metadata

2012-03-30 Thread Cedric Greevey
2012/3/30 Vinzent : > Counter-example: one could write if-authenticated macro, which will take > fixed number of args, but should be indented as normal if. OK, check the macro structure to see if any args are incorporated as invokable forms -- so, in arguments in special forms and macros that are

Re: Source code as metadata

2012-03-30 Thread Lee Spector
On Mar 30, 2012, at 5:11 PM, Cedric Greevey wrote: > > That opens a giant can of worms. How, for example, do we discover that > (partial * 2) and #(* % 2) and (fn [x] (* 2 x)) and #(+ %1 %1) are all > equal? Nevermind once we get into situations like #(reduce + (map > (constantly 1) %) equals #(l

Re: Source code as metadata

2012-03-30 Thread Phil Hagelberg
Vinzent writes: > Probably you slightly misunderstood what I mean. Consider this > scenario: > I've set up a project which uses a new library with non-standart > indent. I've connected to swank and compiled it. Then I'm calling > some clojure-mode-update-indent function, which walks through all >

Re: Source code as metadata

2012-03-30 Thread Vinzent
Counter-example: one could write if-authenticated macro, which will take fixed number of args, but should be indented as normal if. суббота, 31 марта 2012 г. 3:07:23 UTC+6 пользователь Cedric Greevey написал: > > On Fri, Mar 30, 2012 at 1:26 PM, Vinzent wrote: > > Another idea is to put :indenta

Re: Source code as metadata

2012-03-30 Thread Vinzent
Probably you slightly misunderstood what I mean. Consider this scenario: I've set up a project which uses a new library with non-standart indent. I've connected to swank and compiled it. Then I'm calling some clojure-mode-update-indent function, which walks through all loaded namespaces and coll

Re: Source code as metadata

2012-03-30 Thread Cedric Greevey
On Fri, Mar 30, 2012 at 2:48 PM, Nathan Matthews wrote: > Also it bothers me that > > (= (partial * 2) (partial * 2)) > > is false. Logically it shouldn't be right?  If we captured the function > forms, that would enable better equality for functions. That opens a giant can of worms. How, for ex

Re: Source code as metadata

2012-03-30 Thread Cedric Greevey
On Fri, Mar 30, 2012 at 1:26 PM, Vinzent wrote: > Another idea is to put :indentation metadata on vars, so user-defined macros > could be indented properly. Currently I have (define-clojure-indent ...) > with a number of forms in my emacs config file, and it seems to be pretty > common solution. I

Re: Source code as metadata

2012-03-30 Thread Phil Hagelberg
Vinzent writes: > I'm not sure how I feel about indentation rules > changing depending on whether slime is active or not. > > What I was thinking, is that there'd be some function which would > collect and save indentation metadata, so it can be used later. Thus, > active slime connection

Re: Source code as metadata

2012-03-30 Thread Phil Hagelberg
Nathan Matthews writes: > I wrote some code which re-programmed the fn macro to capture the > closures as well as the actual function form, and attach them as > meta-data also on the actual function object. Could you submit it as a patch to serializable-fn? It would be nice to have everything in

Re: Source code as metadata

2012-03-30 Thread Vinzent
> > I'm not sure how I feel about indentation rules > changing depending on whether slime is active or not. > What I was thinking, is that there'd be some function which would collect and save indentation metadata, so it can be used later. Thus, active slime connection required only the first t

Re: Source code as metadata

2012-03-30 Thread Phil Hagelberg
Nathan Matthews writes: > I wanted to serialise functions and send them over the network. The > problem with serializable-fn is that it doesn't capture closures. It's designed to capture closures; if it doesn't that would be an (unsurprising) bug. -Phil -- You received this message because yo

Re: Source code as metadata

2012-03-30 Thread Nathan Matthews
Hi, I wanted to serialise functions and send them over the network. The problem with serializable-fn is that it doesn't capture closures. I wrote some code which re-programmed the fn macro to capture the closures as well as the actual function form, and attach them as meta-data also on the ac

Re: Source code as metadata

2012-03-30 Thread Phil Hagelberg
Vinzent writes: > Phil, what do you think? Could it be experimentally implemented in > clojure-mode? No, clojure-mode determines indentation exclusively from static heuristics. There is dynamic indentation support in slime, but I've never looked into it; I'm not sure how I feel about indentation

Re: Source code as metadata

2012-03-30 Thread Vinzent
Another idea is to put :indentation metadata on vars, so user-defined macros could be indented properly. Currently I have (define-clojure-indent ...) with a number of forms in my emacs config file, and it seems to be pretty common solution. It'd be nice to replace this hack with an IDE-independ

Re: Source code as metadata

2012-03-29 Thread Phil Hagelberg
On Thu, Mar 29, 2012 at 9:29 AM, Petr Gladkikh wrote: > I am pondering on the idea of having more (or even a lot) of metadata > that could be useful for debugging and problem resolution. > Since we can store anything in metadata, can we store not only  source > file path and line number but whole

Source code as metadata

2012-03-29 Thread Petr Gladkikh
I am pondering on the idea of having more (or even a lot) of metadata that could be useful for debugging and problem resolution. Since we can store anything in metadata, can we store not only source file path and line number but whole source code that is associated with piece of code? For example,