What is the << (double left arrow) syntax in YAML called, and where's it specced?

后端 未结 2 695
耶瑟儿~
耶瑟儿~ 2020-12-28 11:59

The <<: operator in YAML is usable to import the contents of one mapping into another, similarly to the ** double-splat operator in Python or

2条回答
  •  温柔的废话
    2020-12-28 12:24

    It is called the Merge Key Language-Independent Type for YAML version 1.1. and specced here

    It is something that parsers can optionally support, it is essentially an interpretation of the key-value pair with the special key <<, where the value is either a mapping (usually indicated via an alias as in the spec, and although that doesn't seem to be required, it makes little sense not to use an alias) or a list of mappings (i.e. aliases of mappings), and gets interpreted in a special way.

提交回复
热议问题