On Fri, Aug 14, 2009 at 3:28 AM, Daniel Lyons<fus...@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 #()?
Right, though I guess I didn't state that very precisely. For example, #() could be implemented as a regular macro if you called it like (lambda ...) or something, or maybe ($ + 5 %) Not as pretty, but it's a pretty minor syntactic difference. 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. However the another difference is that #"" has different quoting rules than "" strings: #"foo\sbar" is more pleasant than (re-pattern "foo\\sbar"), which leads us to point 2: > 2. To achieve DSLs that would screw up the reader, such as the units > one? Or is there a better example? Regex patterns are my favorite example. Why does Rich get to let everyone embed pretty regex expressions, but if I want have my own regex-like mini-language, people will have go through string-escaping contortions to use it? :-) Units is another fine example, as is infix notation without tortured spacing: (infix 5*2) The reader gets upset about that. 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 #'''5*2'''). Again, not pretty but perhaps better than nothing. One argument against wide-open user defined reader macros that I don't think I've heard is that currently any .clj file can be parsed without evaluating any of the code. It can't be compiled without executing macros, but at least it can be parsed. If code can define new reader behaviour, this would no longer be true -- Clojure could be more like Perl! http://www.perlmonks.org/?node_id=663393 --Chouser --~--~---------~--~----~------------~-------~--~----~ 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---