From: Eric W. <scr...@gm...> - 2007-03-18 10:10:16
|
# from Sergei Steshenko # on Saturday 17 March 2007 07:16 pm: >I am not sure I clearly understand what it's about, but why new > syntax/language to describe hierarchical relationship if Perl already > supports hierarchical data structures ? One word: concisification >my $children_array_ref =3D # or should it be hash ref ? No, order matters. >=A0 [ >=A0 =A0 { # first child oops, we lost the order now >=A0 =A0 custom_bit =3D> >=A0 =A0 =A0 { =2E.. >=A0 =A0 text_ctrl =3D> >=A0 =A0 =A0 { >=A0 =A0 =A0 type =3D> 'ctrl', >=A0 =A0 =A0 label =3D> "", # I'm not sure about this >=A0 =A0 =A0 style =3D> >=A0 =A0 =A0 =A0 { >=A0 =A0 =A0 =A0 te =3D> MULTILINE|READONLY|DONTWRAP=20 >=A0 =A0 =A0 =A0 # these are meant to be bitwise OR'ed constants=20 > =A0 =A0 }=20 Yeah, but the te =3D> 'string|string|string' means the style() function=20 can append wxTE_ to the front, so-as to Wx->"wxTE_$thing" it. >=A0 =A0 =A0 } >=A0 =A0 }, > >=A0 =A0 { # second child >=A0 =A0 ... >=A0 =A0 } >=A0 ]; >Whenever I see another language inside Perl, I'm getting really > nervous - another (possibly incomplete) definition, another (possibly > buggy) parser ... Nope, no parser. >Well, the original example is likely still Perl, but why a subroutine > where plain hierarchical data structure should suffice ? The data structure would basically have to be array refs all the way=20 down. Also, the style() function does some mapping. The idea was=20 basically to make a mini-language that would add some unverbosity and=20 other conveniencification. (The Bushism-ated words are jokes. You should laugh now. I'm not=20 really going to extendify the language like that.) A sufficiently expressive data-structure would be good, but it wouldn't=20 be declarative. The benefit of the declarative bits of code is that=20 their procedural guts can remove the need for ']]]]]]]]]]'(did I get=20 enough brackets in there?)-ish stuff. I'm still on the fence about=20 many details of implementing either or both. =2D-Eric =2D-=20 software: a hypothetical exercise which happens to compile. =2D-------------------------------------------------- http://scratchcomputing.com =2D-------------------------------------------------- |