2009/8/12 Chas Emerick <cemer...@snowtide.com>: > > On Aug 12, 2009, at 3:19 PM, Mark Volkmann wrote: > >> I didn't release it was valid to define names with colons in them. >> Maybe that shouldn't be allowed. I'd like to be able to specify type >> hints using UML-like syntax like the second example from Chas which >> was >> >> (defh foo [s:String unhinted-arg {a:int :a}] ...) > > I *really* like the look of s:String (or String:s, which I used in my > quickie impl, they're interchangable), but I can easily see colons > being used for some other syntactic purpose down the road that we're > not yet aware of (ranges come to mind, eg. [0:50] as in python). And > of course, colons and other special characters are very helpful in > representing domain-specific semantics directly in code, so losing > those special characters is an expensive choice that should be weighed > very cautiously.
One possible hack would be to mimic Haskell once again and use a double colon as the separator between the name and the type, i.e. s::String. This would still allow for the use of a single colon (and more than two colons) in normal names, albeit it might be a bit confusing if both were used in the same context. I think that special characters in names make code a lot more readable, and they are useful in DSLs, so I too would hate to see characters being removed from the set of legal characters. Actually, it turns out that the reader does not like more than one colon in the middle (or end) at the moment. This is probably somehow related to how the namespace qualified keywords are read: user> 'foo:bar foo:bar user> 'foo::bar ; Evaluation aborted. user> 'foo:::bar ; Evaluation aborted. user> 'foo: ; Evaluation aborted. user> 'foo:: ; Evaluation aborted. user> ':foo :foo user> '::foo :user/foo user> 'foo???? foo???? > - Chas -- ! Lauri --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---