Re: Source code as metadata

2012-04-01 Thread Phil Hagelberg
Jeff Weiss jeffrey.m.we...@gmail.com 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

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 lspec...@hampshire.edu 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

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

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

Re: Source code as metadata

2012-03-30 Thread Phil Hagelberg
Vinzent ru.vinz...@gmail.com 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

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

Re: Source code as metadata

2012-03-30 Thread Phil Hagelberg
Nathan Matthews nathan.r.matth...@gmail.com 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

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 time

Re: Source code as metadata

2012-03-30 Thread Phil Hagelberg
Nathan Matthews nathan.r.matth...@gmail.com 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

Re: Source code as metadata

2012-03-30 Thread Phil Hagelberg
Vinzent ru.vinz...@gmail.com 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

Re: Source code as metadata

2012-03-30 Thread Cedric Greevey
On Fri, Mar 30, 2012 at 1:26 PM, Vinzent ru.vinz...@gmail.com 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

Re: Source code as metadata

2012-03-30 Thread Cedric Greevey
On Fri, Mar 30, 2012 at 2:48 PM, Nathan Matthews nathan.r.matth...@gmail.com 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

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

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 ru.vinz...@gmail.com wrote: Another idea

Re: Source code as metadata

2012-03-30 Thread Phil Hagelberg
Vinzent ru.vinz...@gmail.com 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

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 #(loop

Re: Source code as metadata

2012-03-30 Thread Cedric Greevey
2012/3/30 Vinzent ru.vinz...@gmail.com: 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

Re: Source code as metadata

2012-03-30 Thread Cedric Greevey
On Fri, Mar 30, 2012 at 6:17 PM, Lee Spector lspec...@hampshire.edu 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

Re: Source code as metadata

2012-03-29 Thread Phil Hagelberg
On Thu, Mar 29, 2012 at 9:29 AM, Petr Gladkikh petrg...@gmail.com 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