Steven: Regarding Alex Miller's "Voting" message of today, you could consider voting on this related ticket if you are so inclined: http://dev.clojure.org/jira/browse/CLJ-1527
I just realized that having a warning in a lint tool like Eastwood for using characters other than those explicitly endorsed in the documentation might be useful. I also suspect a lot of people would want it off by default, given that it might be fairly noisy for some projects. Andy On Tue, Nov 8, 2016 at 8:17 AM, Steven Yi <steve...@gmail.com> wrote: > Hi Alex, > > Thanks for the reply, that was how I understood the intention of that text > as well. It is ambiguous though, considering the discussion of > auto-gensyms later in the page mentions: > > "If a symbol is non-namespace-qualified and ends with '#', it is resolved > to a generated symbol with the same name to which '_' and a unique id have > been appended. e.g. x# will resolve to x_123. All references to that symbol > within a syntax-quoted expression resolve to the same generated symbol." > > Which is to say, the text describes symbol names and using '#'. > > Anyways, I get that '#' usage remains open for interpretation and later > design decisions. I thought maybe because it was already used in > auto-gensyms and because of how read() and syntaxQuote() relate in > LispReader, it might mean that '#' became a definitive part of permitted > symbol name characters. I think a second look at that made me realize it > could still be reinterpreted. > > So, although I like the use of '#' for my use case, it's easy enough to > revise my design to use a different character here. > > That said, wouldn't it better then for the compiler be made more > restrictive now (i.e., only permit symbol names with '#' within syntax > quote)? For example, the following compiles and runs fine in the REPL: > > (let [a# 4 b#a 3] (println a# b#3)) > > Because you're telling me I can not depend on '#' for symbols, I will have > to make this change in some released code, where I had been using '#' in > keywords, and that's a breaking change for my API. It would have been much > nicer for me if such reserved things are treated as errors, so that I don't > write valid code now that is at risk of breaking later. > > There are also other characters, such as '$', '%', '=', '&', '|', '>', > '<', that also work now but are not listed in the website text regarding > symbol names. Some, like '=', '>', and '<' are in common use as part of > symbol names. ('$' seems often used with as->). As a user, I see one > description in text, but in real world code I see other things in use, and > that makes it confusing. It would be useful (to me at least) to have this > be a little clearer what is reserved and what is not. > > Thanks! > steven > > > > On Monday, November 7, 2016 at 8:38:28 PM UTC-5, Alex Miller wrote: >> >> >> >> On Monday, November 7, 2016 at 6:33:49 PM UTC-6, Steven Yi wrote: >>> >>> Hi All, >>> >>> I wanted to understand whether '#' may be treated as a valid character >>> for symbols. The Clojure site [1] has: >>> >>> "Symbols begin with a non-numeric character and can contain >>> alphanumeric characters and *, +, !, -, _, ', and ? (other characters >>> may be allowed eventually)." >>> >> >> The general advice here is that the characters listed here are guaranteed >> to be valid now and in the future. Characters not listed here may be >> accepted now or used within Clojure, but are not guaranteed to work in the >> future. >> >> >>> I realized I was using # today in a symbol without thinking much of >>> it. However, the syntax highlighting in Vim marked it oddly when it >>> was at the end of the symbol name versus in the middle of the name. >>> (The use case is denoting musical notes using lists of symbols, such >>> as '(c c# d eb) ). >>> >> >> Same as above - this works now, but is not guaranteed to always be valid. >> >> auto-gensyms also employ # as part of symbol names, but I do not know >>> if that should be considered a kind of special case. >>> >> >> Same as above - Clojure may use these symbols to mean special things >> (like auto gensyms in syntax quote), but that right is reserved for Clojure. >> >> >>> Any clarifications appreciated! >>> steven >>> >>> [1] - http://clojure.org/reference/reader >>> >> -- > 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 unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.