On 30 April 2012 18:24, Jay Fields <j...@jayfields.com> wrote: > Thank you Laurent. You said exactly what I meant, it's not a user defined > symbol.. it's a "lib"... > > I'm not really sure why this is such an issue. The name of the Java class > contains a $. If you want to use that class, you use a $. If you're defining > a symbol, the docs on http://clojure.org/reader don't list $ as a valid > character. If you want to guarantee you don't have an issue in the future, > don't use a $. If you're okay with possibly having an issue in the future, > use whatever character you like. A character doesn't need to be "valid" to > be used, and the docs don't state that using $ is "invalid". The docs make a > guarantee on specific characters, what you do with that information is > completely up to "consenting adults"
I think you've summarized the issue very well. We agree entirely on the facts. I am just curious as to how we've ended up in a situation where parts of the Java interop are based on underspecified parts of the reader behaviour. Phil > On Mon, Apr 30, 2012 at 12:45 PM, Laurent PETIT <laurent.pe...@gmail.com> > wrote: >> >> 2012/4/30 Ben Smith-Mannschott <bsmith.o...@gmail.com> >>> >>> On Mon, Apr 30, 2012 at 18:22, Jay Fields <j...@jayfields.com> wrote: >>> > Foo$Bar is the name of the class, and $ is a valid character in a Java >>> > class >>> > name. Foo$Bar is not a clojure symbol. >>> >>> Sure it is. The reader has to read it somehow. Otherwise the compiler >>> will have nothing to work with. Also: >>> >>> user=> (symbol? (read-string "foo$bar")) >>> true >>> >>> But, since $ isn't documented as being a valid character in a symbol, >>> I guess it's one of those cases of "undefined behavior". Perhaps >>> Clojure's own interop shouldn't build on undefined behavior? >> >> >> Shouldn't that be interpreted as : $ is a reserved character in symbols, >> and you cannot create symbols with $ inside them. That is, what is valid >> symbol construction from the consumer side is not the same of what is the >> set of accepted symbols from the reader library author side ... ? >> >>> >>> >>> // ben >>> >>> > >>> > On Mon, Apr 30, 2012 at 12:19 PM, Philip Potter >>> > <philip.g.pot...@gmail.com> >>> > wrote: >>> >> >>> >> Note that, even though this works, $ is not a valid character in a >>> >> clojure symbol. >>> >> >>> >> See >>> >> >>> >> http://groups.google.com/group/clojure/browse_thread/thread/5af5d892f2e84212/0c5dc6b6a1578f07?#0c5dc6b6a1578f07 >>> >> >>> >> and http://clojure.org/reader >>> >> >>> >> So: is the behaviour discussed intentional? If so, should $ be made >>> >> explicitly valid in symbols? >>> >> >>> >> Phil >>> >> >>> >> On 30 April 2012 16:59, Jay Fields <j...@jayfields.com> wrote: >>> >> > That's correct. You'll want to make sure you (:import Foo$Bar) also. >>> >> > >>> >> > more >>> >> > >>> >> > >>> >> > info: http://blog.jayfields.com/2011/01/clojure-using-java-inner-classes.html >>> >> > >>> >> > Cheers, Jay >>> >> > >>> >> > On Mon, Apr 30, 2012 at 11:44 AM, Tassilo Horn >>> >> > <tass...@member.fsf.org> >>> >> > wrote: >>> >> >> >>> >> >> nick rothwell <n...@cassiel.com> writes: >>> >> >> >>> >> >> > I'm faced with the following in some legacy code: >>> >> >> > >>> >> >> > public interface Foo { interface Bar { ... String BAZ = "baz"; >>> >> >> > ... }} >>> >> >> > >>> >> >> > Is there any way of accessing Foo.Bar.BAZ in the Clojure world? >>> >> >> > I've >>> >> >> > tried various combinations of proxying and reifying with no joy. >>> >> >> >>> >> >> Not tested, but I think it's Foo$Bar/BAZ. >>> >> >> >>> >> >> Bye, >>> >> >> Tassilo >>> >> >> >>> >> >> -- >>> >> >> 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 >>> >> > >>> >> > >>> >> > -- >>> >> > 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 >>> >> >>> >> -- >>> >> 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 >>> > >>> > >>> > -- >>> > 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 >>> >>> -- >>> 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 >> >> >> -- >> 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 > > > -- > 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 -- 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