Changes between Version 2 and Version 3 of PerlTagScheme


Ignore:
Timestamp:
05/13/06 13:52:20 (9 years ago)
Author:
anonymous
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PerlTagScheme

    v2 v3  
     1Tags in the form of '!!perl/...' have a full form of !<tag:yaml.org,2002:perl/...>. This implies that implementation that use '!!perl/...' for tagging, should strive to stick with in the confines described in this document. 
     2 
    13These are the unblessed Perl basic types: 
    24 
     
    2022}}} 
    2123 
    22 There could be a form that requires there to be a class in memory to handle it. If there is no Foo::Bar class, an exception is thrown. 
     24A YAML Loader that sees a form like that above, will simply bless the referent to create the object. The 'Foo::Bar' class' YAML API will not be called. 
     25 
     26There also needs to be a standard tag form for a class which implements its own yaml API. In this case, YAML Loader will throw an exception if there is no class to load the object. The following options are under consideration. 
    2327 
    2428{{{ 
    25 !!perl/object:Foo::Bar  # object type is determined by Foo::Bar 
     29!!perl/object:Foo::Bar 
     30!!perl/:Foo::Bar 
     31!!perl/Foo::Bar 
    2632}}} 
    2733 
    28 These blessed forms could be shortened to: 
    29  
    30 {{{ 
    31 !!perl/:Foo.Bar   # Foo::Bar hash (can't use % in urls) 
    32 !!perl/@Foo.Bar   # Foo::Bar array 
    33 !!perl/$Foo.Bar   # Foo::Bar scalar 
    34 !!perl/&Foo.Bar   # Foo::Bar code 
    35 !!perl/+Foo.Bar   # Foo::Bar io 
    36 !!perl/*Foo.Bar   # Foo::Bar glob 
    37 !!perl/\Foo.Bar   # Foo::Bar reference 
    38 !!perl/Foo.Bar    # Foo::Bar object 
    39 }}} 
     34Note: the first form, while more verbose, more closely matches what Python and Ruby do. (I think) See [wiki:http://pyyaml.org/wiki/PythonTagScheme]. 
    4035 
    4136The '!!perl' forms are only consumable by Perl. To share objects with Python, maybe use this form: 
     
    4439!!object:Foo.Bar 
    4540}}} 
    46