Re: [community-group] [Format] Token name - reserved words (#61)

There's a bunch of property names that have a special meaning in our spec, so I believe these necessarily need to be reserved words: `value`, `type`, `description`, `extensions`...

It might be a good idea to have a section somewhere that lists them all for convenience.

It's likely that future spec iterations will add more (we've already been talking about things like `deprecated`, `version` & `author`), but I don't know if we should "landgrab" some others that we think we _might_ need in future.

If we do, we may unnecessarily limit what people can name their tokens and groups (e.g.  it seems `default` is already being used as a token name by some teams).

If we don't, we may may find it hard to add more properties in future spec versions.

So, how about this as an alternative: What if all spec properties started with a certain symbol. Taking a bit of inspiration from JSON schema, we could use a `$` prefix.

So, `value` becomes `$value`, `type` becomes `$type` and so on. An example file might then look like this:

```jsonc
{
  "$description": "The description of this group",
  "token name": {
    "$value": "100px",
    "$type": "dimension"
  },
  "another token": { 
    "$value": "#abcdef",
    "$type": "color"
  }
}
```

**Pros:**
- Easier to avoid naming clashes in the future
- Perhaps makes it easier to see which properties are spec things and which are author-defined token and group names

**Cons.**
- Might be a bit trickier to work with in code (e.g. in JavaScript you'd always need to access things like `token['$value']` intead of `token.value`)
- Arguably looks a bit ugly
- Is a fairly big change from the current draft spec, which has already been reviewed by several desig tool vendors

Thoughts?

-- 
GitHub Notification of comment by c1rrus
Please view or discuss this issue at https://github.com/design-tokens/community-group/issues/61#issuecomment-918642084 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 13 September 2021 22:54:42 UTC