From: Brian I. <briani@ActiveState.com> - 2001-06-03 20:44:28
|
"Clark C . Evans" wrote: > > On Sun, Jun 03, 2001 at 05:15:56PM +0200, Oren Ben-Kiki wrote: > | I had this notion about the syntactical form of class-as-color (or any > | color). What if one allows the first key pair to appear immediately after > | the '%': > | > | delivery: % : 10-JAN-2001 > | # : date > | > | OK, the class has to appear on a separate line, but that's not *too* bad, > | textually. Especially after removing some whitespace: > | > | delivery:%: 10-JAN-2001 > | #: date > > If we want to "abbreviate", why not just allow > the single line form... > > delivery: !date 10-JAN-2001 > > to be an abbreviation for ... > > delivery: % > ! : date > "" : 10-JAN-2001 > I wrote my last email suggesting "inline classes" without even seeing this. We must be on a similar wave length. :) However, be aware that we are suggesting two different things. You are suggessting an abbreviation of coloring. I am suggesting a "lightweight" semantic for Inline classes. One that would not round trip between Perl and Java, but would round trip between Perl and Perl. It's a disposable class I guess, at least from the YAML side. Something like this will be vital to allow scripting languages (or at least Perl) to use objects in their normal, lightweight way. FYI, In Perl an object is just any old data structure with a name attached by the bless() function. It can access it's data in through predefined methods or not. It actually turns out to be a very compelling OO model. But that's a different discussion. Now Perl can also benefit from a heavyweight colored YAML object. For instance, to redefine the emitter sort order, or to ensure that the emmitter uses the correct encoding. Or for round tripping data to Java. But the bottom line is that if you want to keep Perl interested (and me too) you *need* a lightweight semantic option. BTW, If the Perl implementation is done right, it will make YAML so much more appealling tham XML. Cheers, Brian -- perl -le 'use Inline C=>q{SV*JAxH(char*x){return newSVpvf ("Just Another %s Hacker",x);}};print JAxH+Perl' |