[community-group] Define order of operations during parsing of tokens files (#123)

romainmenke has just created a new issue for https://github.com/design-tokens/community-group:

== Define order of operations during parsing of tokens files ==
At the moment there doesn't seem to be a specific order in the specification for certain operations during parsing.

This leads to ambiguity when multiple tokens files are combined.

For example :

1. parse token files in order of declaration (whatever declaration is)
2. add all tokens to a shared token bag
   2.1. if a token already exists, override it
3. dereference all token values

or

1. parse token files in order of declaration (whatever declaration is)
2. add tokens to a specific token bag
3. dereference all token values in isolation
4. add all tokens to a shared token bag
   4.1. if a token already exists, override it

-----------

**file a, loaded first** :

```json
{
 "font": {
  "family": {
   "sans-serif": { "$value": "sans" },
   "base": { "$value": "{font.family.sans-serif}" }
  }
 }
}
```

**file b, loaded second** :

```json
{
 "font": {
  "family": {
   "$sans-serif": { "value": "Helvetica" }
  }
 }
}
```

What is the value of `font.family.base`?
1. `sans`
7. `Helvetica`

------------

**file a, loaded first** :

```json
{
 "font": {
  "family": {
   "base": { "$value": "{font.family.sans-serif}" }
  }
 }
}
```

**file b, loaded second** :

```json
{
 "font": {
  "family": {
   "sans-serif": { "$value": "sans" },
   
  }
 }
}
```

Does this give an error because `font.family.sans-serif` is not yet defined?
Or does it lazily resolve?

Please view or discuss this issue at https://github.com/design-tokens/community-group/issues/123 using your GitHub account


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

Received on Sunday, 3 April 2022 09:00:16 UTC