Skip to content

Commit 6fddc9c

Browse files
authored
Merge pull request #376 from Peefy/update-config-pattern
chore: update config pattern
2 parents fb9590b + 329f0c7 commit 6fddc9c

File tree

27 files changed

+56
-29
lines changed

27 files changed

+56
-29
lines changed

docs/user_docs/concepts/type-and-definition.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ KCL features a **gradual static type system**, initially designed to consider sc
99
The configuration of attributes and types in KCL usually follows a simple pattern:
1010

1111
$$
12-
k = (T) v
12+
k\ o \ (T) \ v
1313
$$
1414

1515
where $k$ is the attribute name, $v$ is the attributes value, and $T$ is the type annotation. Since KCL has the ability of the type inference, $T$ is usually omitted.

docs/user_docs/getting-started/intro.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ While KCL is not a general-purpose language, it excels within its specific domai
6565
KCL's attribute configuration follows a simple pattern:
6666

6767
$$
68-
k op (T) v
68+
k\ o \ (T) \ v
6969
$$
7070

71-
where $k$ is the attribute name, $v$ is the attributes value, $op$ is the attribute operator and $T$ is the type annotation. Since KCL has the ability of the type inference, $T$ is usually omitted. `deploy = Deployment {}` is a simple example that satisfies the pattern.
71+
where $k$ is the attribute name, $v$ is the attributes value, $o$ is the attribute operator and $T$ is the type annotation. Since KCL has the ability of the type inference, $T$ is usually omitted. `deploy = Deployment {}` is a simple example that satisfies the pattern.
7272

7373
This is an example of generating Kubernetes manifests.
7474

i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/concepts/type-and-definition.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ KCL features a **gradual static type system**, initially designed to consider sc
99
The configuration of attributes and types in KCL usually follows a simple pattern:
1010

1111
$$
12-
k = (T) v
12+
k\ o \ (T) \ v
1313
$$
1414

1515
where $k$ is the attribute name, $v$ is the attributes value, and $T$ is the type annotation. Since KCL has the ability of the type inference, $T$ is usually omitted.

i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/getting-started/intro.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ KCL 试图提供独立于运行时的可编程性,不在本地提供线程和
6666
KCL 配置通常遵循如下模式:
6767

6868
$$
69-
k op (T) v
69+
k\ o \ (T) \ v
7070
$$
7171

72-
其中,$k$ 是属性名称,$v$ 是属性值,$op$ 是属性运算符,$T$ 是类型注解。由于 KCL 具有类型推导的能力,因此 $T$ 通常可以省略。比如 `deploy = Deployment {}` 就是一个符合该模式的简单示例。
72+
其中,$k$ 是属性名称,$v$ 是属性值,$o$ 是属性运算符,$T$ 是类型注解。由于 KCL 具有类型推导的能力,因此 $T$ 通常可以省略。比如 `deploy = Deployment {}` 就是一个符合该模式的简单示例。
7373

7474
下面是一个用 KCL 生成 Kubernetes 资源的例子
7575

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5/user_docs/concepts/type-and-definition.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ KCL features a **gradual static type system**, initially designed to consider sc
99
The configuration of attributes and types in KCL usually follows a simple pattern:
1010

1111
$$
12-
k = (T) v
12+
k\ o \ (T) \ v
1313
$$
1414

1515
where $k$ is the attribute name, $v$ is the attributes value, and $T$ is the type annotation. Since KCL has the ability of the type inference, $T$ is usually omitted.

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5/user_docs/getting-started/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ KCL 试图提供独立于运行时的可编程性,不在本地提供线程和I
6161
KCL 配置通常遵循如下模式:
6262

6363
$$
64-
k = (T) v
64+
k\ o \ (T) \ v
6565
$$
6666

6767
其中,$k$ 是属性名称,$v$ 是属性值,$T$ 是类型注解。由于 KCL 具有类型推导的能力,因此 $T$ 通常可以省略。

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.6/user_docs/concepts/type-and-definition.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ KCL features a **gradual static type system**, initially designed to consider sc
99
The configuration of attributes and types in KCL usually follows a simple pattern:
1010

1111
$$
12-
k = (T) v
12+
k\ o \ (T) \ v
1313
$$
1414

1515
where $k$ is the attribute name, $v$ is the attributes value, and $T$ is the type annotation. Since KCL has the ability of the type inference, $T$ is usually omitted.

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.6/user_docs/getting-started/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ KCL 试图提供独立于运行时的可编程性,不在本地提供线程和I
6464
KCL 配置通常遵循如下模式:
6565

6666
$$
67-
k = (T) v
67+
k\ o \ (T) \ v
6868
$$
6969

7070
其中,$k$ 是属性名称,$v$ 是属性值,$T$ 是类型注解。由于 KCL 具有类型推导的能力,因此 $T$ 通常可以省略。

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7/user_docs/concepts/type-and-definition.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ KCL features a **gradual static type system**, initially designed to consider sc
99
The configuration of attributes and types in KCL usually follows a simple pattern:
1010

1111
$$
12-
k = (T) v
12+
k\ o \ (T) \ v
1313
$$
1414

1515
where $k$ is the attribute name, $v$ is the attributes value, and $T$ is the type annotation. Since KCL has the ability of the type inference, $T$ is usually omitted.

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7/user_docs/getting-started/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ KCL 试图提供独立于运行时的可编程性,不在本地提供线程和I
6464
KCL 配置通常遵循如下模式:
6565

6666
$$
67-
k = (T) v
67+
k\ o \ (T) \ v
6868
$$
6969

7070
其中,$k$ 是属性名称,$v$ 是属性值,$T$ 是类型注解。由于 KCL 具有类型推导的能力,因此 $T$ 通常可以省略。

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.8/user_docs/concepts/type-and-definition.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ KCL features a **gradual static type system**, initially designed to consider sc
99
The configuration of attributes and types in KCL usually follows a simple pattern:
1010

1111
$$
12-
k = (T) v
12+
k\ o \ (T) \ v
1313
$$
1414

1515
where $k$ is the attribute name, $v$ is the attributes value, and $T$ is the type annotation. Since KCL has the ability of the type inference, $T$ is usually omitted.

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.8/user_docs/getting-started/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ KCL 试图提供独立于运行时的可编程性,不在本地提供线程和
6666
KCL 配置通常遵循如下模式:
6767

6868
$$
69-
k = (T) v
69+
k\ o \ (T) \ v
7070
$$
7171

7272
其中,$k$ 是属性名称,$v$ 是属性值,$T$ 是类型注解。由于 KCL 具有类型推导的能力,因此 $T$ 通常可以省略。

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.9/reference/lang/tour.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,15 @@ data = {
611611
} # {"key1": "value1", "key2": "value2"}
612612
```
613613

614+
请注意,当属性中存在 `-``.` 等其他连字符时,我们必须使用引号。
615+
616+
```python
617+
data = {
618+
"config.dot.attr" = "value1" # Note we use `"config.dot.attr"` instead of `config.dot.attr` here.
619+
"config-hyphen-attr" = "value2" # Note we use `"config-hyphen-attr"` instead of `config-hyphen-attr` here.
620+
}
621+
```
622+
614623
此外,**选择表达式**可以用于定义包含嵌套键 dict 实例。
615624

616625
```python

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.9/user_docs/concepts/type-and-definition.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ KCL features a **gradual static type system**, initially designed to consider sc
99
The configuration of attributes and types in KCL usually follows a simple pattern:
1010

1111
$$
12-
k = (T) v
12+
k\ o \ (T) \ v
1313
$$
1414

1515
where $k$ is the attribute name, $v$ is the attributes value, and $T$ is the type annotation. Since KCL has the ability of the type inference, $T$ is usually omitted.

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.9/user_docs/getting-started/intro.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ KCL 试图提供独立于运行时的可编程性,不在本地提供线程和
6666
KCL 配置通常遵循如下模式:
6767

6868
$$
69-
k op (T) v
69+
k\ o \ (T) \ v
7070
$$
7171

72-
其中,$k$ 是属性名称,$v$ 是属性值,$op$ 是属性运算符,$T$ 是类型注解。由于 KCL 具有类型推导的能力,因此 $T$ 通常可以省略。比如 `deploy = Deployment {}` 就是一个符合该模式的简单示例。
72+
其中,$k$ 是属性名称,$v$ 是属性值,$o$ 是属性运算符,$T$ 是类型注解。由于 KCL 具有类型推导的能力,因此 $T$ 通常可以省略。比如 `deploy = Deployment {}` 就是一个符合该模式的简单示例。
7373

7474
下面是一个用 KCL 生成 Kubernetes 资源的例子
7575

versioned_docs/version-0.5/user_docs/concepts/type-and-definition.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ KCL features a **gradual static type system**, initially designed to consider sc
99
The configuration of attributes and types in KCL usually follows a simple pattern:
1010

1111
$$
12-
k = (T) v
12+
k\ o \ (T) \ v
1313
$$
1414

1515
where $k$ is the attribute name, $v$ is the attributes value, and $T$ is the type annotation. Since KCL has the ability of the type inference, $T$ is usually omitted.

versioned_docs/version-0.5/user_docs/getting-started/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Although KCL is not a general language, it has corresponding application scenari
5959
The configuration of attributes in KCL usually meets the simple pattern:
6060

6161
$$
62-
k = (T) v
62+
k\ o \ (T) \ v
6363
$$
6464

6565
where $k$ is the attribute name, $v$ is the attributes value, and $T$ is the type annotation. Since KCL has the ability of the type inference, $T$ is usually omitted.

versioned_docs/version-0.6/user_docs/concepts/type-and-definition.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ KCL features a **gradual static type system**, initially designed to consider sc
99
The configuration of attributes and types in KCL usually follows a simple pattern:
1010

1111
$$
12-
k = (T) v
12+
k\ o \ (T) \ v
1313
$$
1414

1515
where $k$ is the attribute name, $v$ is the attributes value, and $T$ is the type annotation. Since KCL has the ability of the type inference, $T$ is usually omitted.

versioned_docs/version-0.6/user_docs/getting-started/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Although KCL is not a general language, it has corresponding application scenari
6464
The configuration of attributes in KCL usually meets the simple pattern:
6565

6666
$$
67-
k = (T) v
67+
k\ o \ (T) \ v
6868
$$
6969

7070
where $k$ is the attribute name, $v$ is the attributes value, and $T$ is the type annotation. Since KCL has the ability of the type inference, $T$ is usually omitted.

versioned_docs/version-0.7/user_docs/concepts/type-and-definition.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ KCL features a **gradual static type system**, initially designed to consider sc
99
The configuration of attributes and types in KCL usually follows a simple pattern:
1010

1111
$$
12-
k = (T) v
12+
k\ o \ (T) \ v
1313
$$
1414

1515
where $k$ is the attribute name, $v$ is the attributes value, and $T$ is the type annotation. Since KCL has the ability of the type inference, $T$ is usually omitted.

versioned_docs/version-0.7/user_docs/getting-started/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Although KCL is not a general language, it has corresponding application scenari
6464
The configuration of attributes in KCL usually meets the simple pattern:
6565

6666
$$
67-
k = (T) v
67+
k\ o \ (T) \ v
6868
$$
6969

7070
where $k$ is the attribute name, $v$ is the attributes value, and $T$ is the type annotation. Since KCL has the ability of the type inference, $T$ is usually omitted.

versioned_docs/version-0.8/user_docs/concepts/type-and-definition.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ KCL features a **gradual static type system**, initially designed to consider sc
99
The configuration of attributes and types in KCL usually follows a simple pattern:
1010

1111
$$
12-
k = (T) v
12+
k\ o \ (T) \ v
1313
$$
1414

1515
where $k$ is the attribute name, $v$ is the attributes value, and $T$ is the type annotation. Since KCL has the ability of the type inference, $T$ is usually omitted.

versioned_docs/version-0.8/user_docs/getting-started/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Although KCL is not a general language, it has corresponding application scenari
6666
The configuration of attributes in KCL usually meets the simple pattern:
6767

6868
$$
69-
k = (T) v
69+
k\ o \ (T) \ v
7070
$$
7171

7272
where $k$ is the attribute name, $v$ is the attributes value, and $T$ is the type annotation. Since KCL has the ability of the type inference, $T$ is usually omitted.

versioned_docs/version-0.9/reference/lang/tour.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ data = {
604604
} # {"key1": "value1", "key2": "value2"}
605605
```
606606

607-
We can ignore the key quotation marks when we writing simple literals on the key.
607+
We can ignore the attribute quotation marks when we writing simple literals on the key.
608608

609609
```python
610610
data = {
@@ -613,6 +613,15 @@ data = {
613613
} # {"key1": "value1", "key2": "value2"}
614614
```
615615

616+
Note that when there is `-`, `.` and other hyphens in the attribute, we must use quotation marks.
617+
618+
```python
619+
data = {
620+
"config.dot.attr" = "value1" # Note we use `"config.dot.attr"` instead of `config.dot.attr` here.
621+
"config-hyphen-attr" = "value2" # Note we use `"config-hyphen-attr"` instead of `config-hyphen-attr` here.
622+
}
623+
```
624+
616625
In addition, the **config selector expressions** can be used to init a dict instance with nested keys.
617626

618627
```python

versioned_docs/version-0.9/user_docs/concepts/type-and-definition.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ KCL features a **gradual static type system**, initially designed to consider sc
99
The configuration of attributes and types in KCL usually follows a simple pattern:
1010

1111
$$
12-
k = (T) v
12+
k\ o \ (T) \ v
1313
$$
1414

1515
where $k$ is the attribute name, $v$ is the attributes value, and $T$ is the type annotation. Since KCL has the ability of the type inference, $T$ is usually omitted.

versioned_docs/version-0.9/user_docs/getting-started/intro.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ While KCL is not a general-purpose language, it excels within its specific domai
6565
KCL's attribute configuration follows a simple pattern:
6666

6767
$$
68-
k op (T) v
68+
k\ o \ (T) \ v
6969
$$
7070

71-
where $k$ is the attribute name, $v$ is the attributes value, $op$ is the attribute operator and $T$ is the type annotation. Since KCL has the ability of the type inference, $T$ is usually omitted. `deploy = Deployment {}` is a simple example that satisfies the pattern.
71+
where $k$ is the attribute name, $v$ is the attributes value, $o$ is the attribute operator and $T$ is the type annotation. Since KCL has the ability of the type inference, $T$ is usually omitted. `deploy = Deployment {}` is a simple example that satisfies the pattern.
7272

7373
This is an example of generating Kubernetes manifests.
7474

versioned_docs/version-0.9/user_docs/support/faq-kcl.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2646,3 +2646,12 @@ $Env:KCL_CACHE_PATH = "C:\temp"
26462646
```
26472647

26482648
After you set the `KCL_CACHE_PATH`, when you run any KCL commands, the `.kclvm` and other KCL-related directories will be generated on the new configured path. Make sure to restart the terminal or any applications that need to use this environment variable, so that they pick up the updated configuration.
2649+
2650+
## 65. How to join a list to a string in KCL?
2651+
2652+
If we want to join a given list L = ['a', 'b', 'c'] into a string with some sepeartor (like a comma ",").
2653+
2654+
```bash
2655+
S = ",".join(['a', 'b', 'c'])
2656+
```
2657+

0 commit comments

Comments
 (0)