From: Brian I. <in...@tt...> - 2001-11-12 00:34:35
|
On 11/11/01 15:18 -0800, Brian Ingerson wrote: > On 11/11/01 18:02 -0500, Clark C . Evans wrote: > > Also, the producion should be ammended to not allow > > an anchor attribute on the same line as an alias node. > > > > Since... > > > > $a = ['val'] > > $b = $a > > $c = $b > > $d = [$a,$b,$c] > > > > is the same as... > > > > $a = ['val'] > > $b = $a > > $c = $a > > $d = [$a,$b,$c] > > > > We know that... > > > > - &001 > > - val > > - &002 *001 > > - *002 > > > > is the same as... > > > > - &001 > > - val > > - *001 > > - *001 > > > > Thus... we can soundly forbid anchor attributes > > on an alias node. > > Well I don't really care. I don't think an emmitter would do it in the first > place, and any human writing up YAML with aliases is probably psychotic. BTW, now that we have coined and defined 'anchors' and 'aliases', can we make the proposed 'org.yaml.ptr', be 'org.yaml.ref'? This would be less confusing to Perlers. (Although the point could be made that they still need to grok 'map' and 'seq') print YAML->emit([ \\\42 ]); --- - !ref =: !ref =: !ref =: 42 # an array where each slot points to the next and # the last slot is 42 $a->[$_] = \ $a->[$_+1] for 0..2; $a->[3] = 42; print YAML->emit($a); --- - !ref &001 (a ref to a ref to a ref to 42) =: !ref &002 =: !ref &003 =: 42 - *001 (a ref to a ref to 42) - *002 (a ref to 42) - *003 (42) $a = \\\\\\\\42 $b = $$$a; $c = $$$b; print YAML->emit( [ $a, $b, $c ] ); --- - !ref =: !ref =: !ref &001 =: !ref =: !ref &002 =: !ref =: !ref =: !ref =: 42 - *001 - *002 Well I'm glad we're using single space indent :) # A self reference $a->[0] = \ $a->[0]; print YAML->emit($a); --- - !ref &001 = *001 I finally grok it well. This is actually very nice. Thanks Oren. |