Re: Can an alias be used to define a new anchor?
Peter Murphy <[email protected]>
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <CANZ_uBibJwKoWwipuQRO6a7LfgM9+qhAt3hANubVdLMz7tOriw@mail.gmail.com> |
On Tue, Sep 9, 2014 at 11:52 PM, Bartek Grychtol <[email protected]> wrote: > Hi Peter, > > Thanks a lot for the quick answer. I guess I'll have to work around it then. > I wonder what's the reason behind this design decision, though..? > As the spec says: "[A]nchor names are a serialization detail and are discarded once composing is completed." Anchor names function as references. You can allow multiple nodes to refer to the same node, and you can even get cyclic references. However, they aren't part of the data. Now, it would be safer to rewrite your YAML as: Images: one: size_x: &ONE_SIZE 100 two: size_x: &TWO_SIZE 100 As you stated "The motivation is that *TWO_SIZE is used lower down independently of *ONE_SIZE, yet they are sometimes, but not always, one and the same thing." In this case, &ONE_SIZE and &TWO_SIZE have the same value, but this is not always the case. Does this help? Best regards, Peter -- Email: [email protected] WWW: http://www.pkmurphy.com.au/ ------------------------------------------------------------------------------ Want excitement? Manually upgrade your production database. When you want reliability, choose Perforce. Perforce version control. Predictably reliable. http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk