From: Brian I. <briani@ActiveState.com> - 2001-05-19 16:18:47
|
I was going to put this into my reply to Oren's block syntax proposal, but I decided that's another issue altogether. BTW, I'm thinking that one over too. I'll reply later today. --- I want to propose yet another way of doing "streams" as we are now calling them. Last night, I had beers with Jeff Hobbs, a very bright guy from the Tcl community (oxymoron? ;). We didn't get into *great* detail on YAML but he had a strong suggestion on string syntax. It involved, wonder of wonders, the double quote. My proposal is adapted from that discussion. The basic idea is that you start every string with a double quote, and just keep going (regardless of line breaks) until you hit the next (unescaped) double quote. Let's try: a: "value" I know. Bear with me. b: "Another value" c: "Another value" Semantically the same as c. d: "Another value" Boggle? But it works because whitespace is insignificant in streams. So indentation is not enforced at all by the *parser*, only by the *emitter*. And this is huge because: e: "Last night, I had beers with Jeff Hobbs, a very bright guy from the Tcl community (oxymoron? ;). We didn't get into *great* detail on YAML but he had a strong suggestion on string syntax. It involved, wonder of wonders, the double quote." I just cut and pasted the above paragraph into e. It parses fine! Now we can dump huge pieces of text into YAML and (with a little escaping by hand) just let the emitter clean things up for us. f: "Last night, I had beers with Jeff Hobbs, a very bright guy from the Tcl community (oxymoron? ;). We didn't get into *great* detail on YAML but he had a strong suggestion on string syntax. It involved, wonder of wonders, the double quote." This is how the value *might* get emitted. Works fine in lists too (per Oren's new ideas on minimal lists): g: @ "value" "Another value" "Works fine in lists too (per Oren's new ideas on minimal lists):" --- Obviously we can omit the quotes on simple values. I'll let Clark come up with the escaping rules, etc. BTW, I'm not even sure we *have* to escape double quotes, unless they come at the end of a line. Just a thought. Brian -- perl -le 'use Inline C=>q{SV*JAxH(char*x){return newSVpvf ("Just Another %s Hacker",x);}};print JAxH+Perl' |