You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by jaxter184 January 9, 2025
I've found KDL to be well-designed to use as a base for a domain-specific scripting language, and shebangs can make scripts more ergonomic to run. Unfortunately, most shebangs are KDL syntax errors (usually because of path separators, but also potentially for other reasons depending on the contents).
I don't think it's a huge deal because the script interpreter can just choose to ignore the first line if it starts with a #! before it passes it into a KDL parser, but my goal in making a discussion about this is to see if anyone's got any better suggestions or examples of this kind of logic being used in the wild. Also, not sure how this kind of workaround would interact with LSPs and syntax highlighters.
There was a mention of shebangs here while discussing a similar syntax: #402, but as far as I can tell, there wasn't an explicit discussion or decision made on whether or not that would be a reasonable thing to do. I wish I had thought about this before the v2 release so they could have maybe been treated as comments (I think that's how the Rust compiler does it?). But such is life.
The text was updated successfully, but these errors were encountered:
I think it would have been good to treat a document-initial (possibly preceded by a bom) #! as a line comment, and would, personally, be ok with still sneaking it in.
In the absence of that, I don't see any ways around it. Either you write a valid KDL document without a shebang, or you write a script where the interpreter knows to discard the shebang. (Or you get "lucky" and write a valid KDL document with a confusing starting node.)
I'm lightly in favor of sucking it up and just issuing v2 errata.
I think that’s why, rather than errata, we could try and do it as part of the IETF RFC, which will likely be slightly different from 2.0.0, and will almost definitely be asked to change by peer reviewers outside of our little community here
Discussed in #472
Originally posted by jaxter184 January 9, 2025
I've found KDL to be well-designed to use as a base for a domain-specific scripting language, and shebangs can make scripts more ergonomic to run. Unfortunately, most shebangs are KDL syntax errors (usually because of path separators, but also potentially for other reasons depending on the contents).
I don't think it's a huge deal because the script interpreter can just choose to ignore the first line if it starts with a
#!
before it passes it into a KDL parser, but my goal in making a discussion about this is to see if anyone's got any better suggestions or examples of this kind of logic being used in the wild. Also, not sure how this kind of workaround would interact with LSPs and syntax highlighters.There was a mention of shebangs here while discussing a similar syntax: #402, but as far as I can tell, there wasn't an explicit discussion or decision made on whether or not that would be a reasonable thing to do. I wish I had thought about this before the v2 release so they could have maybe been treated as comments (I think that's how the Rust compiler does it?). But such is life.
The text was updated successfully, but these errors were encountered: