-
-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge KDL v2 #286
base: main
Are you sure you want to change the base?
Merge KDL v2 #286
Changes from 99 commits
910f6e9
69ac280
2d5e543
1bf4d74
78a2d5f
f38edc7
ffeea8e
337bd1b
825ff2c
0a4a14d
d437cf2
06d1d67
3b39e29
568c096
0836df1
eb55930
99abeef
e6356d5
85aa3a0
2694146
5e89c45
fada1fc
63feef7
31fd7bd
b42b6c8
5a7b339
c8488db
13799de
49402cc
fc1b594
7790505
8de7df6
a0d5030
54df7f0
817a7dc
9f06153
56f399b
b51859e
50d378f
90cd0b1
0022536
39b9fac
055de4e
511ab6b
d433332
d53d99f
057e8c8
419995f
6d359d2
b635470
491cc46
6d091fd
f02ba59
935d054
1294f97
094a615
c273d24
de37e11
24cd214
bc2b995
1f28fb0
1d6809e
af91cc6
2949500
c15b5c2
172c67b
522ce85
35ac19b
2d4bcd0
f767472
40d8c83
b1163e1
f81fcfa
f0f9589
793a9d4
abae1f9
7ab8658
ec7880d
9212117
631ec14
fa816ca
e773747
2710c90
2fcf6d4
dadcfdf
9132a96
9e7b958
b294e9c
2de2ddc
aeb41cc
d0b30c3
281de7e
d064bc9
fa9d303
bea0f67
c9134e3
fa204ce
6a77436
bcfb332
1e924bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# KDL Changelog | ||
|
||
## 2.0.0 (2024-02-07) | ||
|
||
### Grammar | ||
|
||
* Solidus/Forward slash (`/`) is no longer an escaped character. | ||
* Space (`U+0020`) can now be written into quoted strings with the `\s` | ||
escape. | ||
* Single line comments (`//`) can now be immediately followed by a newline. | ||
* All literal whitespace following a `\` in a string is now discarded. | ||
* Vertical tabs (`U+000B`) are now considered to be whitespace. | ||
* The grammar syntax itself has been described, and some confusing definitions | ||
in the grammar have been fixed accordingly (mostly related to escaped | ||
characters). | ||
* `,`, `<`, and `>` are now legal identifier characters. They were previously | ||
reserved for KQL but this is no longer necessary. | ||
* Code points under `0x20` (except newline and whitespace code points), code | ||
points above `0x10FFFF`, Delete control character (`0x7F`), and the [unicode | ||
"direction control" | ||
characters](https://www.w3.org/International/questions/qa-bidi-unicode-controls) | ||
are now completely banned from appearing literally in KDL documents. They | ||
can now only be represented in regular strings, and there's no facilities to | ||
represent them in raw strings. This should be considered a security | ||
improvement. | ||
* Raw strings no longer require an `r` prefix: they are now specified by using | ||
`#""#`. | ||
* Line continuations can be followed by an EOF now, instead of requiring a | ||
newline (or comment). `node \<EOF>` is now a legal KDL document. | ||
* `#` is no longer a legal identifier character. | ||
* `null`, `true`, and `false` are now `#null`, `#true`, and `#false`. Using | ||
the unprefixed versions of these values is a syntax error. | ||
* The spec prose has more explicitly stated that whitespace and newlines are | ||
not valid identifier characters, even though the grammar already expressed | ||
this. | ||
* Bare identifiers can now be used as values in Arguments and Properties, and are interpreted as string values. | ||
* The spec prose now more explicitly states that strings and raw strings can | ||
be used as type annotations. | ||
* A statement in the spec prose that said "It is reasonable for an | ||
implementation to ignore null values altogether when deserializing". This is | ||
no longer encouraged or desired. | ||
* Code points have been constrained to [Unicode Scalar | ||
Values](https://unicode.org/glossary/#unicode_scalar_value) only, including | ||
values used in string escapes (`\u{}`). All KDL documents and string values | ||
should be valid UTF-8 now, as was intended. | ||
* The last node in a child block no longer needs to be terminated with `;`, | ||
even if the closing `}` is on the same line, so this is now a legal node: | ||
`node {foo;bar;baz}` | ||
* More places allow whitespace (node-spaces, specifically) now. With great | ||
power comes great responsibility: | ||
* Inside `(foo)` annotations (so, `( foo )` would be legal (`( f oo )` would | ||
not be, since it has two identifiers)) | ||
* Between annotations and the thing they're annotating (`(blah) node (thing) | ||
1 y= (who) 2`) | ||
* Around `=` for props (`x = 1`) | ||
* The BOM is now only allowed as the first character in a document. It was | ||
previously treated as generic whitespace. | ||
* Multi-line strings are now automatically dedented, according to the common | ||
whitespace matching the whitespace prefix of the closing line. Multiline | ||
strings and raw strings now must have a newline immediately following their | ||
opening `"`, and a final newline plus whitespace preceding the closing `"`. | ||
* SMALL EQUALS SIGN (`U+FE66`), FULLWIDTH EQUALS SIGN (`U+FF1D`), and HEAVY | ||
EQUALS SIGN (`U+1F7F0`) are now treated the same as `=` and can be used for | ||
properties (e.g. `お名前=☜(゚ヮ゚☜)`). They are also no longer valid in bare | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This example doesn't look right: surely |
||
identifiers. | ||
* `.1`, `+.1` etc are no longer valid identifiers, to prevent confusion and | ||
conflicts with numbers. | ||
* Multi-line strings' literal Newline sequences are now normalized to single | ||
`LF`s. | ||
* `#inf`, `#-inf`, and `#nan` have been added in order to properly support | ||
IEEE floats for implementations that choose to represent their decimals that | ||
way. | ||
* Correspondingly, the identifiers `inf`, `-inf`, and `nan` are now syntax | ||
errors. | ||
|
||
### KQL | ||
|
||
* There's now a _required_ descendant selector (`>>`), instead of using plain | ||
spaces for that purpose. | ||
* The "any sibling" selector is now `++` instead of `~`, for consistency with | ||
the new descendant selector. | ||
* Some parsing logic around the grammar has changed. | ||
* Multi- and single-line comments are now supported, as well as line | ||
continuations with `\`. | ||
* Map operators have been removed entirely. |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should the JiK spec mention that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good for a warning, yeah. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry if this has been explained somewhere before, a 100+ comment discussion can be hard to follow.
Speaking purely from a user's perspective, this specific change feels a bit unnecessary. I assume it's being done to prevent ambiguity, but
null
,true
andfalse
are keywords common enough, that I don't think anyone with the slightest experience writing code would be surprised if they have special meanings unlike normal identifiers. If anything, being a Rust user, I would come into this expecting the exact opposite: thattrue
means the boolean and#true
means the raw identifier, similar to how it works in Rust sans ther
.Is there something I'm missing here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We decided this would be enough of a potential footgun since the change to allow unquoted strings. Programming languages like Rust have other defenses against this kind of confusion, but kdl would need to do something different (like this prefixing) to prevent, say, the kind of things you see happen in plain JavaScript
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation, and fair enough, if that's the point of balance you've decided on for your project.