News for hackers. Stuff that matters.
Re:YAML: It's Time to Move On by rhn_mk1 on Sunday November 14, 2021 @03:57PM (#29220623)
Isn't an indent a clear demarcation?
Re:YAML: It's Time to Move On by goodpoint on Sunday November 14, 2021 @05:12PM (#29221217)
Not at all.

If it was code, an indentation error would often not compile or show errors or fail tests.

Configuration in YAML is much worse: most of the time an indentation error goes undetected until an application starts misbehaving.

Significant whitespace is perfectly ok for code but a huge footgun for YAML

Re:YAML: It's Time to Move On by aimor on Sunday November 14, 2021 @04:12PM (#29220758)
Literally, yes.

But I find it incredibly annoying to estimate indentation when lines are wrapped in an editor (or webpage). Or, to a lesser extent but still throws me off, when multiple blocks end at the same line. Or when pasting blocks into another block, and having to double check to make sure the indentation was carried over correctly. I like editors that visually show indentation characters.

Re:YAML: It's Time to Move On by zmmmmm on Sunday November 14, 2021 @04:01PM (#29220656)
Only if you forbid tabs ...
Re:YAML: It's Time to Move On by a9h74j on Sunday November 14, 2021 @07:28PM (#29222135)
If it must be created by non-programmers too delicate to match braces, how about BEGIN .. END and an autoformatter.

Or, NODE <name> .. END .

Re:YAML: It's Time to Move On by dylan604 on Sunday November 14, 2021 @04:40PM (#29220999)
tabs or spaces for that indent?

it makes a difference on how it is parsed, so it's more than a devs preference

Re:YAML: It's Time to Move On by kevincox on Sunday November 14, 2021 @05:49PM (#29221514)
It really doesn't matter. Just force the leading indent to be exactly the same bytes. If indent moves between two values where one isn't a prefix of the other raise an error.
Re:YAML: It's Time to Move On by dylan604 on Sunday November 14, 2021 @07:02PM (#29221987)
is one \t the same as \s{4,} in bytes? that doesn't make any sense
Re:YAML: It's Time to Move On by kevincox on Sunday November 14, 2021 @07:07PM (#29222018)
No it isn't. That is the point. If you have one line indented with 4 spaces and one line indented with a tab there is no correct answer what the difference of indent is. The only good option is to raise an error.
Re:YAML: It's Time to Move On by dylan604 on Sunday November 14, 2021 @07:11PM (#29222035)
right, or encapsulate in some sort of braces ;-)
Re:YAML: It's Time to Move On by kevincox on Sunday November 14, 2021 @07:19PM (#29222084)
Sure, that is another option. But your code still looks confusing.

Personally I mostly use indent to read code, so requiring that the indent matches the semantic nesting makes it much easier for me to understand.

Re:YAML: It's Time to Move On by dylan604 on Sunday November 14, 2021 @08:28PM (#29222570)
Looks confusing to who? Another coder? Then they have issues.

I get the original was talking about client facing config files. I'd rather see INI style config files personally.

If you're writing ugly code, braces or spaces won't save you. Just don't write ugly code.* Write it like the next person to view your code is an axe murder that knows where you live, so don't make them mad. You can minify later.

*I'm ignoring Perl, as it's always ugly