News for hackers. Stuff that matters.
Re:No YAML by eyelidlessness on Wednesday October 27, 2021 @11:43PM (#29022144)
> Is json code, too?

I’m amazed this is even a question. Of course it is! It’s explicitly defined as an interchange format. Its only purpose is as code.

> In an informal setting.

What formal settings are we supposed to be satisfying?

> If you are, for example, writing documentation, please refrain from doing so.

I respectfully decline this request.

> But that's entirely situational. A yaml snippet containing my list of groceries is not code.

> Yaml doesn't have to be classified as code to be testable. "We should have tests for our configuration files" is perfectly reasonable.

I mean this with kindness and sincerity, if a little incredulity: maybe your definition of code is ambiguous and warrants some clarification. To me, this isn’t a holistic definition but it certainly seems like a relevant starting point: if it has a syntax specification that machines can use, it’s code.

Re:No YAML by alephu5 on Thursday October 28, 2021 @01:48AM (#29022811)
The most useful definition (for engineering) is that "code" changes/defines how the program executes. Your YAML shopping list changes your path through the shop, so it is code.

For non-trivial programs the configuration space is so large that it's impractical to test every single configuration during development, so instead the operators are expected to test before putting into production.

Re:No YAML by ChrisLomont on Thursday October 28, 2021 @08:14AM (#29025123)
>Of course it is! It’s explicitly defined as an interchange format.

So an INI file is code too?

Generally people think of code as being executed and doing some task. Can you use JSON to compute prime numbers?

Re:No YAML by reegnz on Thursday October 28, 2021 @11:10AM (#29027022)
A language does not need to be considered Turing complete to be considered code.
Re:No YAML by ChrisLomont on Thursday October 28, 2021 @07:33PM (#29033422)
It needs to perform some computation, right?

Or is code now any structured data read by a program?

Re:No YAML by olodus on Friday October 29, 2021 @03:56PM (#29042863)
A python script could be a text doc if you open it in a markdown editor. A yaml file could execute web call if run through a program with a parser.

It is all up to the interpreter you give the code too. Your program that takes yaml config is an interpreter, though probably a very limited one and hopefully a safe one (though that needs to be tested / checked for to be more sure of)

Re:No YAML by eyelidlessness on Friday October 29, 2021 @12:11AM (#29035092)
Now? XML has been code for decades.
Re:No YAML by emodendroket on Thursday October 28, 2021 @12:12AM (#29022291)
I would guess most would define "code" as being written in a Turing-complete language.
Re:No YAML by bmn__ on Thursday October 28, 2021 @03:06AM (#29023260)
The guess is based on what?

When I observe the world, I come to a different conclusion. I see people including non-programmers talk about HTML as code. I see software packages like editors that say they deal with code, and it's not about T-c languages. Encyclopedias and dictionaries record the definition of code very broadly as interpretation of information, not T-c languages specifically.

Re:No YAML by emodendroket on Thursday October 28, 2021 @10:24AM (#29026481)
I meant to restrict this to programmers. Who knows what lay people think.
Re:No YAML by eyelidlessness on Thursday October 28, 2021 @01:50AM (#29022819)
So without engaging the ongoing absurd debate about HTML or CSS… can you really say that SVG isn’t code? Forget what “most” would say. In your heart of hearts, can you write <path d="…anything at all"/> and not consider it code? What a disappointing pissing contest.