Re: Request for Discussion: user created reader macros

2009-08-20 Thread Meikel Brandmeyer
Hi, On Aug 20, 4:59 pm, Brian Hurt bhur...@gmail.com wrote: This I like better, and I may take a crack at doing this over the next weekend.  Have some sort of parser object that starts life parsing the same s-expression syntax as the standard Clojure reader but allows for extensions.  This

Re: Request for Discussion: user created reader macros

2009-08-20 Thread Brian Hurt
On Fri, Aug 14, 2009 at 7:00 PM, Jonathan Smith jonathansmith...@gmail.comwrote: It would be nice if someone wrote a separate extension to clojure that (reads in a text file and) that does tokenization and manipulation of said tokens (I'm thinking YACC, flex/bison sort of thing). (Then you

Re: Request for Discussion: user created reader macros

2009-08-14 Thread Chouser
On Aug 14, 2009, at 12:48 AM, Daniel Lyons fus...@storytotell.org wrote: On Aug 13, 2009, at 5:30 PM, Bradbev wrote: More complex reader macros could be (infix x + y + z / 3). I think you can already do that with regular macros. I don't think so. Macros are invoked after the read

Re: Request for Discussion: user created reader macros

2009-08-14 Thread Chouser
On Aug 14, 2009, at 2:03 AM, Chouser chou...@gmail.com wrote: On Aug 14, 2009, at 12:48 AM, Daniel Lyons fus...@storytotell.org wrote: On Aug 13, 2009, at 5:30 PM, Bradbev wrote: More complex reader macros could be (infix x + y + z / 3). I think you can already do that with

Re: Request for Discussion: user created reader macros

2009-08-14 Thread Daniel Lyons
On Aug 14, 2009, at 12:12 AM, Chouser wrote: That particular example may not have to be a macro at all: http://paste.lisp.org/display/75230 Wonderful! :) I think people want reader macros for a couple different reasons. Sometimes it's just to remove parens from a function or macro call.

Re: Request for Discussion: user created reader macros

2009-08-14 Thread Laurent PETIT
Just to add a bit of contradiction to the debate: it is generally told to people coming to lisp that lisp is all about giving power to users, and it's up to them to take care of not shooting themselves in the foot. E.g. that' the general answer when one complains that there's no static typing with

Re: Request for Discussion: user created reader macros

2009-08-14 Thread Mark Addleman
I suspect that reader macros are necessary to fully realize named- argument message passing. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com

Re: Request for Discussion: user created reader macros

2009-08-14 Thread Boris Mizhen - 迷阵
One thing that I would like to see implemented seems like a good candidate for a reader macro... I find it useful to have a way to comment out an expression by prefixing it with some symbol. I.E. if a '/' before an expression is an expression comment, it is easy to experiment with code: (foo

Re: Request for Discussion: user created reader macros

2009-08-14 Thread Chouser
On Fri, Aug 14, 2009 at 10:20 AM, Boris Mizhen - 迷阵bo...@boriska.com wrote: One thing that I would like to see implemented seems like a good candidate for a reader macro... I find it useful to have a way to comment out an expression by prefixing it with some symbol. I.E. if a '/' before

Re: Request for Discussion: user created reader macros

2009-08-14 Thread Chouser
On Fri, Aug 14, 2009 at 3:28 AM, Daniel Lyonsfus...@storytotell.org wrote: On Aug 14, 2009, at 12:12 AM, Chouser wrote: Perhaps these different desires can fulfilled with two different constructs. The two being: 1. To remove parens from a function or macro call. You mean e.g. # and #()?

Re: Request for Discussion: user created reader macros

2009-08-14 Thread Richard Newman
Similarly # is pretty close to what the re-pattern function does. One difference is that # compiles the regex at read time while re-pattern compiles it runtime. If re-pattern were a macro that difference would essentially disappear. In code, yes, it would disappear because you can shift

Re: Request for Discussion: user created reader macros

2009-08-14 Thread Chas Emerick
On Aug 14, 2009, at 10:49 AM, Chouser wrote: So in general 1 is in my opinion a fairly minor syntax thing, while 2 could be somewhat alleviated if Clojure had a string literal format that allowed un-escaped double quotes and left backslashes unmolested. This would allow things like (infix

Re: Request for Discussion: user created reader macros

2009-08-14 Thread Brian Hurt
On Thu, Aug 13, 2009 at 4:59 PM, Daniel Lyons fus...@storytotell.orgwrote: On Aug 13, 2009, at 2:30 PM, Brian Hurt wrote: I'm just wondering what people's response would be to allow user-generated reader macros. I'm not sure, but I think the only change to the clojure core that would be

Re: Request for Discussion: user created reader macros

2009-08-14 Thread Jonathan Smith
On Aug 14, 11:46 am, Brian Hurt bhur...@gmail.com wrote: On Thu, Aug 13, 2009 at 4:59 PM, Daniel Lyons fus...@storytotell.orgwrote: On Aug 13, 2009, at 2:30 PM, Brian Hurt wrote: I'm just wondering what people's response would be to allow user-generated reader macros. I'm not sure,

Re: Request for Discussion: user created reader macros

2009-08-14 Thread Richard Newman
Reading the responses to this thread, and thinking about things, I've come around to this point of view. What I wanted was the ability to read Clojure data structures from a file or from stdin in a way that I could extend- for long, involved reasons I need to specify byte arrays (as

Request for Discussion: user created reader macros

2009-08-13 Thread Brian Hurt
I'm just wondering what people's response would be to allow user-generated reader macros. I'm not sure, but I think the only change to the clojure core that would be necessary in order to do this would be that in clojure/src/jvm/clojure/lang, LispReader.dispatchMacros would have to be made

Re: Request for Discussion: user created reader macros

2009-08-13 Thread Daniel Lyons
On Aug 13, 2009, at 2:30 PM, Brian Hurt wrote: I'm just wondering what people's response would be to allow user- generated reader macros. I'm not sure, but I think the only change to the clojure core that would be necessary in order to do this would be that in

Re: Request for Discussion: user created reader macros

2009-08-13 Thread Meikel Brandmeyer
Hi, Am 13.08.2009 um 22:30 schrieb Brian Hurt: Now, I can certainly see a lot of potiential downsides to this. Redefining what #{} or #() means is just the start. I think, this is the reason Rich is not very positive for that idea: because nobody came up with a way of defining namespaces

Re: Request for Discussion: user created reader macros

2009-08-13 Thread Chas Emerick
On Aug 13, 2009, at 4:59 PM, Daniel Lyons wrote: On Aug 13, 2009, at 2:30 PM, Brian Hurt wrote: I'm just wondering what people's response would be to allow user- generated reader macros. I'm not sure, but I think the only change to the clojure core that would be necessary in order to

Re: Request for Discussion: user created reader macros

2009-08-13 Thread Aaron Cohen
On Thu, Aug 13, 2009 at 5:14 PM, Meikel Brandmeyerm...@kotka.de wrote: Hi, Am 13.08.2009 um 22:30 schrieb Brian Hurt: Now, I can certainly see a lot of potiential downsides to this.  Redefining what #{} or #() means is just the start. I think, this is the reason Rich is not very positive

Re: Request for Discussion: user created reader macros

2009-08-13 Thread Aaron Cohen
On Thu, Aug 13, 2009 at 5:23 PM, Aaron Cohenremled...@gmail.com wrote: On Thu, Aug 13, 2009 at 5:14 PM, Meikel Brandmeyerm...@kotka.de wrote: Hi, Am 13.08.2009 um 22:30 schrieb Brian Hurt: Now, I can certainly see a lot of potiential downsides to this.  Redefining what #{} or #() means is

Re: Request for Discussion: user created reader macros

2009-08-13 Thread Bradbev
What is the main point of reader macros? Is it so you can define your own short-hand syntax, or is it the ability to get more direct access to the reader? If it is the first point, then I'd be happy to not have them - to me shorthand doesn't buy much. If it is the second point then why not

Re: Request for Discussion: user created reader macros

2009-08-13 Thread Daniel Lyons
On Aug 13, 2009, at 3:35 PM, Bradbev wrote: What is the main point of reader macros? Is it so you can define your own short-hand syntax, or is it the ability to get more direct access to the reader? If it is the first point, then I'd be happy to not have them - to me shorthand doesn't

Re: Request for Discussion: user created reader macros

2009-08-13 Thread Bradbev
On Aug 13, 3:43 pm, Daniel Lyons fus...@storytotell.org wrote: On Aug 13, 2009, at 3:35 PM, Bradbev wrote: What is the main point of reader macros?  Is it so you can define your own short-hand syntax, or is it the ability to get more direct access to the reader? If it is the first

Re: Request for Discussion: user created reader macros

2009-08-13 Thread Scott
On Aug 13, 1:30 pm, Brian Hurt bhur...@gmail.com wrote: I'm just wondering what people's response would be to allow user-generated reader macros. [...] I think you could get most of the benefits for DSL's by using regular strings, except that regular strings have quoting issues:

Re: Request for Discussion: user created reader macros

2009-08-13 Thread Chas Emerick
On Aug 13, 2009, at 8:29 PM, Scott wrote: A single super quoted string reader would avoid this problem. Instead of defining a new read syntax like: #my-syntax(your DSL goes between here and here) Clojure could provide a general purpose string creating read syntax. Something like #... A

Re: Request for Discussion: user created reader macros

2009-08-13 Thread Michele Simionato
On Aug 14, 2:47 am, Chas Emerick cemer...@snowtide.com wrote: On Aug 13, 2009, at 8:29 PM, Scott wrote: A single super quoted string reader would avoid this problem. Instead of defining a new read syntax like:  #my-syntax(your DSL goes between here and here) Clojure could provide a

Re: Request for Discussion: user created reader macros

2009-08-13 Thread Richard Newman
So, what are people's thoughts? Trying to use them in Common Lisp has frustrated the crap out of me. The only library I know of that promulgates them seriously is CL-SQL and the gymnastics you have to do to install the reader macros are frustrating. Another library I tried to use I

Re: Request for Discussion: user created reader macros

2009-08-13 Thread Scott
On Aug 13, 5:47 pm, Chas Emerick cemer...@snowtide.com wrote: A good thought, but #foo is reader syntax for defining a regular   expression with the pattern foo. :-/ Sorry about that, I'm not experienced at Clojure, but I should have been more clear. The first important part isn't which

Re: Request for Discussion: user created reader macros

2009-08-13 Thread Adrian Cuthbertson
Hmm, not so sure this is related, but I've often thought it would be great to have some way of having embedded source of other types as a special string defined as normal in the clojure source but marked in such as way that the editor (vim, emacs, etc) could recognise this and do formatting,

Re: Request for Discussion: user created reader macros

2009-08-13 Thread Daniel Lyons
On Aug 13, 2009, at 5:30 PM, Bradbev wrote: More complex reader macros could be (infix x + y + z / 3). I think you can already do that with regular macros. I don't think so. Macros are invoked after the read stage but before evaluation of arguments. This kind of macro would be invoked