News for hackers. Stuff that matters.
Re:That's a Lot of YAML by sevensor on Friday April 11, 2025 @08:55AM (#43653248)
Trailing commas for sure, but I buy the argument that comments would be used to sneak in arbitrary directives and break interoperability. In fact, I’d like to see a less featureful JSON where everything is strings. Trivial parsing, leave interpretation up to the receiver.
Re:That's a Lot of YAML by OskarS on Friday April 11, 2025 @10:08AM (#43653971)
For a configuration language, comments are absolutely crucial. You want to be able to say "# This option is set because <so-and-so>" to explain why you are configuring it this way to the next person that reads the code (or you, in the future).

If the price to pay is that there is some risk some dummy might start parsing the comments as code, so be it. This is not a really a problem in "regular" programming languages, I don't see why it would be in a configuration language.

Re:That's a Lot of YAML by mdaniel on Friday April 11, 2025 @11:19AM (#43654832)
> This is not a really a problem in "regular" programming languages

https://go.dev/wiki/Comments#directives :-D

Re:That's a Lot of YAML by gotimo on Friday April 11, 2025 @12:30PM (#43655666)
They said "regular" programming languages
Re:That's a Lot of YAML by mmh0000 on Friday April 11, 2025 @01:10PM (#43656106)
I will start by saying, I completely agree with you!

But, then, I have to behave like a typical computer nerd and say..

Well ackchuallyyyyyy:

  > "This is not a really a problem in "regular" programming languages"
Browsers do stupid: <!--[if IE 8]>

Linux does stupid: #!/bin/bash

C/C++ (preprocessor marcos) do stupid: #ifdef

https://en.wikipedia.org/wiki/Conditional_comment

https://en.wikipedia.org/wiki/Comment_(computer_programming)

Re:That's a Lot of YAML by everforward on Saturday April 12, 2025 @01:44AM (#43661663)
I don’t think the Linux one is that stupid, but it might be me.

It’s not a “magic comment” because it doesn’t depend on the runtime. It specifies an interpreter to use, regardless of the language of the file.

Eg you can use #!/usr/bin/python for a Python script. I don’t find it worse than the existing alternative of making the file name magic and finding and interpreter based on that.

Re:That's a Lot of YAML by mmh0000 on Thursday April 17, 2025 @11:34AM (#43718367)
It is a magic comment though.

It's a comment ignored by the interpreter (bash, python, whatever).

The kernel just says "Hey! You can't execute a text file, you weirdo! I'll just read the very first line of the text file and if it happens to be a comment that points to another executable, I'll run that and pass it this file."

Re:That's a Lot of YAML by daymanstep on Saturday April 12, 2025 @06:29PM (#43668411)
Macros are not comments.
Re:That's a Lot of YAML by rk06 on Friday April 11, 2025 @12:47PM (#43655864)
Comments by themselves provide enough value to justify their supports.

Plus non standard stuff is not a valid argument. As there are many tools which support non standard behaviour, because useful features like comment are considered non standard