Jsonnet
https://www.facebook.com/rick.kyhwang/posts/10210736739654008
#Jsonnet 0 是 json 的超集 (superset) 專案,是個資料結構樣板語言 (Data Templating Language),增強了 json 的弱點,從 Feature 來看,算是個 DSL (Domain-specific Language)。
底下是他的 Features 1:
- Syntax (語法): 支援 comment, 變數 (範圍), namespace
- Variables (變數): local,
- References (變數參考): self. , $refers, ['field'] ...
- Arithmetic (運算): 支援 floating, bitwise, boolean logic, ==, ... 等常見運算
- Functions: 可以寫函式,有標準函式庫 2 ...
- Conditionals (條件式判斷): if / else / then
- Computed Field Names: 物件可以當作資料結構處理
- Array and Object Comprehension: 支援類似 Python 的 list 走訪語法,直接展開 Array Element.
- Imports: 支援 import text, json, .libsonnet
- Errors: 支援 assert
- Parameterize Entire Config: 參數化整個配置,分 外部變數和最上層參數
- Object-Orientation (物件導向) ....