Skip to content
This repository has been archived by the owner on Jan 14, 2022. It is now read-only.

Repeating $ vs repeating Shape #3

Closed
cecilemuller opened this issue Oct 17, 2014 · 1 comment
Closed

Repeating $ vs repeating Shape #3

cecilemuller opened this issue Oct 17, 2014 · 1 comment
Labels

Comments

@cecilemuller
Copy link
Member

A question from the X3D mailing-list referencing #1 :

Wondering then, what about your repeated use of "$", isn't that the same sort of repetition as repeating "Shape" and "Transform" ?

(Edit: $ used to be called _type at the time)

@cecilemuller
Copy link
Member Author

The main difference is that using Shape as object property adds one extra nesting level.
Let's take a list of three shapes for example.

Using Shape as property, it needs three levels:

[
    {
        "Shape": {
            ...
        }
    },
    {
        "Shape": {
            ...
        }
    },
    {
        "Shape": {
            ...
        }
    }
]

because you can't do this given key/value pairs implies an Object, not an Array:

[
    "Shape": {
        ...
    },
    "Shape": {
        ...
    },
    "Shape": {
        ...
    }
]

and you can't do this either (c.f. #2 ):

{
    "Shape": {
        ...
    },
    "Shape": {
        ...
    },
    "Shape": {
        ...
    }
}

The same list using $ only needs two levels:

[
    {
        "$": "Shape"
        ...
    },
    {
        "$": "Shape"
        ...
    },
    {
        "$": "Shape"
        ...
    }
]

@cecilemuller cecilemuller changed the title Repeating _type vs repeating Shape Repeating $ vs repeating Shape Dec 21, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant