I would that the existing format of pr-str would work, no?. I often structure Exception error strings like:
foo-service: bad value=2 foo-service: bad value="2" Does that not keep it unambiguous? Alan On Fri, Nov 13, 2015 at 10:59 AM, Colin Yates <colin.ya...@gmail.com> wrote: > Hi Ben, > > I’m pretty sure we are all on the same page that rendering a string with a > single character of 2 is “2”. > > Regarding not needing a delimiter: if everybody everywhere signed up to > this then yes, I agree - no delimiter is necessary. Until that becomes true > then I still think a delimiter is useful, in which case “2” isn’t entirely > unambiguous given that some people would use quotes as a delimiter. My > principle (far too big a word to describe this) is ‘be idiomatic’ > ‘use > prior art’ > ‘be unambiguous’. > > Your examples also disambiguate through the use of contrasting examples, > which unfortunately isn’t always possible, or at least taken advantage of. > > So, I still claim that whilst there is only one way of rendering values an > idiomatic delimiter when rendering that value has value, and if that > delimiter is nothing at all, I’m fine with that as well :-). As I said > before, I care less about the delimiter than the consistency of using it > :-). > > On 13 Nov 2015, at 17:47, Ben Wolfson <wolf...@gmail.com> wrote: > > On Fri, Nov 13, 2015 at 5:47 AM, Colin Yates <colin.ya...@gmail.com> > wrote: > >> Really, I don’t mind - I would just like consistency :-) >> >> One argument for the right delimiter of some sort is that it is >> unambiguous and therefore nobody can misinterpret it. If you were >> unfamiliar with a validation library and it reported <start>[:a :b :c must >> be “2”]</start> you _could_ interpret that as either the literal 2 or a >> string containing 2. To interpret it correctly you must know more than >> just the literal text, therefore it isn’t a great choice. >> > > The choice of delimiter seems independent of how to render the value in > question. To my mind there's exactly one correct, and obviously correct, > way to render an EDN value which is a string containing the single > character \2, and it's the second one: > > "2" > > If you want to refer to the value by wrapping it in quotation marks of > some kind, thereby delimiting it from some surrounding text, you'll need a > delimiter of some sort. But you might not want to do that at all; you might > want to set off the value you're rendering by indenting it: > > expected value: "2" > received value: 2 > > pretty clear to me. The importance of consistency is that if you're going > to quote an EDN value to refer to it in one part of the message, then you > should do so with all values in all parts. This is clear: > > expected value ""2"", received value "2" > > this is not: > > expected value "2" [unquoted string], received value "2" [quoted number] > > Using the same symbol for quotation of values in the metalanguage as is > used for quotation of strings in the object language is a little inelegant, > I guess, but as long as it's consistent it seems pretty manageable. > > > >> I like _ because <start>[:a :b :c must be _”2”_]</start> is less open to >> misinterpretation because the _ symbol is not part of the Clojure grammar >> (unlike brackets and quotes). It is also idiomatic to use as a symbol to >> mean “I don’t care about the value of this” which has some symmetry (albeit >> at a stretch) in the use I am proposing here. >> >> On 13 Nov 2015, at 13:19, Atamert Ölçgen <mu...@muhuk.com> wrote: >> >> Hi Colin, >> >> Why not just "2"? >> >> On Fri, Nov 13, 2015 at 1:55 PM, Colin Yates <colin.ya...@gmail.com> >> wrote: >> >>> Hi all, >>> >>> Can we, the community agree a consistent way of rendering Clojure EDN >>> when we report it in info or error. For example, given the EDN "2" (i.e. a >>> string containing a single character 2) I have seen various libraries >>> render it as: >>> >>> - 2 >>> - "2" >>> - ["2"] >>> - [2] >>> - (2) >>> - '"2"' >>> >>> I would like to propose that we standardise around "_" as the boundary >>> character as that isn't likely to be used in (except for some markup I >>> guess but that is pretty unlikely), so a test framework might render as >>> such: >>> >>> - expected _2_ but was _"2"_ >>> >>> Please? :-) >>> >>> -- >>> 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. >>> >> >> >> >> -- >> Kind Regards, >> Atamert Ölçgen >> >> ◻◼◻ >> ◻◻◼ >> ◼◼◼ >> >> www.muhuk.com >> >> -- >> 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. >> > > > > -- > Ben Wolfson > "Human kind has used its intelligence to vary the flavour of drinks, which > may be sweet, aromatic, fermented or spirit-based. ... Family and social > life also offer numerous other occasions to consume drinks for pleasure." > [Larousse, "Drink" entry] > > > -- > 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. > -- 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.