On 30/10/02 08:36 +1100, Damian Conway wrote:
> Brian Ingerson wrote:
> 
> > Speaking of persistence, I just realized I'll need to start thinking about
> > YAML serializations of superpositions. My first cut at it would be:
> > 
> >     ---
> >     letters: !super [0, 1, 2]
> >     digits: !super
> >       - 0
> >       - 1
> >       - 2
> >     ...
> 
> Not quite. You also need to discriminate the *type* of the superposition:

Oh right. I was thinking that C<any> and friends were operations, not types.
Oops.

YAML type-URIs are made up of a type-family with an optional format:

    !domain.com/type#format

and:

    !int

is shorthand for:

    !yaml.org/int#dec

So I'm wondering if any|all|one|none can be formats of !super? And if so,
should there be a default format?
    
>        letters: !any [0, 1, 2]
>        digits: !all
>          - 0
>          - 1
>          - 2
>        names: !one ["Brian", "Ingy", "Mr Inline"]
>        sane: !none
>          - "Larry"
>          - "Damian"
>          - "Brian"
>        ...

Here are some options:

    ---
    # !yaml.org/any
    letters: !any [a, b, c]
    
    # !yaml.org/super#all
    digits: !super#all
      - 0
      - 1
      - 2

    # !perl.yaml.org/one     (Perl specific types)
    names: !perl/one [Brian, Ingy, Mr 
                      Inline]         # (Yes, this dwims :)

    # !perl.yaml.org/super-none  (longer type name, no format)
    sane: !perl/super-none
      - Larry
      - Damian
      - Brian
    ...

It might be more forward thinking to allow any|all|one|none into the
yaml.org type repository.

!perl/glob is staying right where it is, thank you ;)

Cheers, Brian

Reply via email to