FSK B

>b's weblog

News. Journal. Whatever.

Sleepy bunny„Glücksatlas“ auf allen Kanälen – ein weiterer Beleg für die weite Verbreitung des gesteuerten Kampagnenjournalismus

YML 2 feature of the day: Shapes

Shapes are a new feature in YML 2 version 5. They're between generics and inheritance. Shapes aren't influencing the name of the tag which is generated. Let's see an example:

% yml2proc          
decl coords(x=0, y=0);
decl typed +type +name;

decl poi <coords, typed>;

poi gas_station Aral x=2.34, y=3.45
^D
<poi y="3.45" x="2.34" type="gas_station" name="Aral" />
% _

As you can see, the first two decl statements are defining features, which then are referenced by the decl poi statement in the angle brackets. So the poi function inherits all of the declared features, as well the x and y attributes as well as the +type and +name descending attributes.

Shapes are patching with their features in the sequence they're applied. Features which are double will be overwritten:

% yml2proc 
decl a(x=0);
decl b(x=1);

decl c <a, b>;

c
^D
<c x="1"/>
% _
publiziert Tue, 20 Sep 2011 19:31:49 +0200 #software #yml

Zurück zum Blogindex