Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
does our resident stan.yaml consider themselves an experienced yaml engineer?

Adbot
ADBOT LOVES YOU

12 rats tied together
Sep 7, 2006

no, it's not possible to "engineer yaml" because it is just a markup language. it doesn't do anything by itself

person who authored this article is likely just a dumbass although i don't recall that part of it so maybe mocking yaml engineers is the 1 correct thing in it

Share Bear
Apr 27, 2004

html

Bloody
Mar 3, 2013

I updated some appveyor yaml today and it was a breeze. just copy pasted chunks from another project ezpz

Powerful Two-Hander
Mar 10, 2004

Mods please change my name to "Tooter Skeleton" TIA.



this guys name is Ruud Van Asseldonk

e: I hadn't actually read the article until now and wow that is the dumbest poo poo I ever read

Powerful Two-Hander fucked around with this message at 09:51 on Jan 14, 2023

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.
a perfectly cromulent Dutch name

Soricidus
Oct 21, 2010
freedom-hating statist shill

12 rats tied together posted:

what's the difference between the yaml 1.1 schema assuming implicitly that nn:nn is for time, and your ideal scenario here?

how can a generic wire format/markup language have a schema that is simultaneously not implicit, even though !!str is apparently an unreasonable ask, but also supports values that are of an arbitrary type

this feels like a fake complaint. the article starts off by examining base 60 numbers that end up in fields in the docker api. this happens because they use the generic fallback schema from 2005 and because, in that schema, they don't specify a type for their values, and the schema resolves them to something that was not intended by the human

is the problem that there even is a fallback schema? your ideal yaml fails to serialize unless you specify that you're using tags.yaml.org:dockerContainer? i don't necessarily disagree, just trying to understand

?????

by “schema” I mean like an xml schema or a json schema. a thing that defines the content for a particular type of document, like what keys are valid and what types their values have.

it may be named in the document but ideally the application will know which schema to apply because it’s the one that describes the data the application knows how to use. it may even be generated automatically from the objects being serialised, but if so it will still be provided to the parser to ensure values are parsed correctly, or at least to identify and explain cases where something was not the expected type.

yaml per se does not have a schema at all. a document with explicit types like you use has an implicit single-use schema, but that’s worthless for validation because it just describes what’s there, not what *should* be there.

use a drat schema, whatever serialisation format you choose.

Xarn
Jun 26, 2015

12 rats tied together posted:

i have good news for you then, the failsafe schema in yaml 1.2 (2009) only has string, sequence, and mapping

you can consult your library for details on how to parse documents with this schema

Genuinely glad to hear that, but we don't ingest yaml and 3rd party places that do use various incompetent libraries :shrug:

mystes
May 31, 2006

12 rats tied together posted:

no, it's not possible to "engineer yaml" because it is just a markup language. it doesn't do anything by itself
Bridges aren't turning complete either

jony neuemonic
Nov 13, 2009

Bloody posted:

I would simply use xml

hell yeah brother

matti
Mar 31, 2019

Powerful Two-Hander posted:

this guys name is Ruud Van Asseldonk

lol

CPColin
Sep 9, 2003

Big ol' smile.

Fixed

12 rats tied together
Sep 7, 2006

Soricidus posted:

?????

by “schema” I mean like an xml schema or a json schema. a thing that defines the content for a particular type of document, like what keys are valid and what types their values have.

it may be named in the document but ideally the application will know which schema to apply because it’s the one that describes the data the application knows how to use. it may even be generated automatically from the objects being serialised, but if so it will still be provided to the parser to ensure values are parsed correctly, or at least to identify and explain cases where something was not the expected type.

yaml per se does not have a schema at all. a document with explicit types like you use has an implicit single-use schema, but that’s worthless for validation because it just describes what’s there, not what *should* be there.

use a drat schema, whatever serialisation format you choose.
It does have schemas, a wire format only speaks byte array, it's not possible to parse without a schema. The thing in 1.1 that goes "22:22? Must be base 60" is a schema. PyYAML (which the article author was complaining about) has several loader classes that have their own schemas embedded. The golang lib, according to the article author, chose to implement its own custom version of the 1.1 schema.

A rare example of a good yaml lib, the crystal stdlib has an entire namespace for interacting with YAML schemas and instructions for registering your own types, in a handy macro. But even PyYAML, widely regarded as absolute dogshit, provides these instructions in the section "Constructors, representers, resolvers", sadly with a much worse API.

If your definition of "a schema" is "a file that defines a schema", these absolutely exist in YAML, but they are of course the same thing. How else would an XML parser load additional schema machinery from an xsd file? Is it schema files all the way down?

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

(editing to be more precise)

I don't see a user-defined schema used in that crystal-lang url: the other poster is talking about the reverse of:

code:
require "yaml"

string = YAML.build do |yaml|
  yaml.mapping do
    yaml.scalar "foo"
    yaml.sequence do
      yaml.scalar 1
      yaml.scalar 2
    end
  end
end
string # => "---\nfoo:\n- 1\n- 2\n"
ie. a variation on parse(data) that takes a user-defined schema indicating "the thing I'm parsing must contain a scalar named "foo", a sequence of pairs of scalars" or whatever. By contrast, here's an example of an XML schema validating a particular class of XML document. Sounds like you're confusing this with the grammar for YAML itself maybe?

12 rats tied together posted:

If your definition of "a schema" is "a file that defines a schema", these absolutely exist in YAML, but they are of course the same thing. How else would an XML parser load additional schema machinery from an xsd file? Is it schema files all the way down?
Not if something self-describing is at the bottom.

Dijkstracula fucked around with this message at 00:57 on Jan 15, 2023

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
Ultimately, the type that a piece of data should be is not defined by the config file itself - it's defined by what the application intends to do with that data. Sometimes that's explicit in the form of a schema, sometimes that's implicit in that the application will just do the wrong thing if it's not the data type that the application author intended.

If you allow your parsing library to choose data types for a parse based on what's in the file being parsed rather than based on what the application intends to do with that data, the only thing you gain is the possibility for type mismatches causing undesired behaviour. There's no upside.

12 rats tied together
Sep 7, 2006

As the link indicates, this is an XSD file, which is XML that can be interpreted to configure machinery (additional types, and restrictions on values for those types) for other XML documents. There used to exist other ways of validating XML than XSD, some of them might even be around still.

Some ways you might produce a file that defines an additional set of types (in yaml: "application specific tags") and restrictions on values for these types would be: json-schema, kwalify, rx, yamale. There are a bunch of others in various levels of popularity. Most of them are not very popular, none of them are YAML in the same way that XSD is not XML.

edit: I guess json-schema is pretty popular actually.

Jabor posted:

Ultimately, the type that a piece of data should be is not defined by the config file itself - it's defined by what the application intends to do with that data. Sometimes that's explicit in the form of a schema, sometimes that's implicit in that the application will just do the wrong thing if it's not the data type that the application author intended.

If you allow your parsing library to choose data types for a parse based on what's in the file being parsed rather than based on what the application intends to do with that data, the only thing you gain is the possibility for type mismatches causing undesired behaviour. There's no upside.
`<first-name>Benjamin</first-name>' and '!first-name Benjamin'. Why is one of these bad and one of them is good?

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

12 rats tied together posted:

As the link indicates, this is an XSD file, which is XML that can be interpreted to configure machinery (additional types, and restrictions on values for those types) for other XML documents. There used to exist other ways of validating XML than XSD, some of them might even be around still.

Some ways you might produce a file that defines an additional set of types (in yaml: "application specific tags") and restrictions on values for these types would be: json-schema, kwalify, rx, yamale. There are a bunch of others in various levels of popularity. Most of them are not very popular, none of them are YAML in the same way that XSD is not XML.
this is fine but I don't think it's invalidating anything we're saying :confused:

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

12 rats tied together posted:

`<first-name>Benjamin</first-name>' and '!first-name Benjamin'. Why is one of these bad and one of them is good?

Do you actually think those are equivalent in how they're used?

mystes
May 31, 2006

Dijkstracula posted:

this is fine but I don't think it's invalidating anything we're saying :confused:
Post the schema for your posts and we'll find out

Brain Candy
May 18, 2006


there's a turtle underneath your turtle and just because you stopped looking at this one does not make it the bottom

12 rats tied together
Sep 7, 2006

Jabor posted:

Do you actually think those are equivalent in how they're used?

If OPs assertion was "the way that yaml is typically abused by morons and the freedom of the grammar that enables it, is bad" I would have simply posted the :hai: emoji.

Soricidus
Oct 21, 2010
freedom-hating statist shill

12 rats tied together posted:

As the link indicates, this is an XSD file, which is XML that can be interpreted to configure machinery (additional types, and restrictions on values for those types) for other XML documents. There used to exist other ways of validating XML than XSD, some of them might even be around still.

Some ways you might produce a file that defines an additional set of types (in yaml: "application specific tags") and restrictions on values for these types would be: json-schema, kwalify, rx, yamale. There are a bunch of others in various levels of popularity. Most of them are not very popular, none of them are YAML in the same way that XSD is not XML.

edit: I guess json-schema is pretty popular actually.

`<first-name>Benjamin</first-name>' and '!first-name Benjamin'. Why is one of these bad and one of them is good?

the equivalent yaml to <first-name>Benjamin</first-name> is ‘first-name: Benjamin’. in both cases that is how you represent the value ‘Benjamin’ being assigned to the first-name field.

idk how the hell ‘!first-name Benjamin’ would be used. do you really have a dedicated first-name type that can be used for any value of any field?

Antigravitas
Dec 8, 2019

Die Rettung fuer die Landwirte:
https://github.com/marciniuk/undertale/blob/master/scripts/SCR_TEXT.gml

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang




oof thats like the code i wrote when i was 12

Chalks
Sep 30, 2009

Carthag Tuek posted:

oof thats like the code i wrote when i was 12

game maker is a truly horrible language. it's like it's designed by someone who'd only ever used javascript, but didn't really understand even that.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
that's "decompiled" code and not actually the code in its original form. the giant switch is it packing all of the separately editable screens into a state machine and all the magic numbers were hopefully named constants

Antigravitas
Dec 8, 2019

Die Rettung fuer die Landwirte:

12 rats tied together
Sep 7, 2006

Soricidus posted:

the equivalent yaml to <first-name>Benjamin</first-name> is ‘first-name: Benjamin’. in both cases that is how you represent the value ‘Benjamin’ being assigned to the first-name field.

idk how the hell ‘!first-name Benjamin’ would be used. do you really have a dedicated first-name type that can be used for any value of any field?

no, i was being terse, if i were to reproduce the XSD example i would have !bookstore probably.


i used to work on a video game that has "what happens when someone uses an ability" expressed in a 200k LoC switch case statement. i dont recall the case count because it was "case skill_id" and the skill_ids had a firewall-rule-like system where ids 0 through 16k were reserved for patch 1, and so on

games are moments away from falling apart basically all the time. even the ones that look like they arent

tef
May 30, 2004

-> some l-system crap ->
i have bad news about how the sausage is made lads

Powerful Two-Hander
Mar 10, 2004

Mods please change my name to "Tooter Skeleton" TIA.


tef posted:

i have bad news about how the sausage is made lads

yeah the casing is pretty gross

mystes
May 31, 2006

I only use artificial sausage cases to test my spaghetti code

Plank Walker
Aug 11, 2005

mystes posted:

I only use artificial sausage cases to test my spaghetti code

drake no: mockFoobar
drake yes: impossible™Foobar

Share Bear
Apr 27, 2004

i thought it was widely well known that many game code bases are horrors because a lot of it gets generated by (usually custom, but sometimes game maker and unity) tooling

FlapYoJacks
Feb 12, 2009
Who cares if undertales code is bad. It’s a good game.

tef
May 30, 2004

-> some l-system crap ->

Share Bear posted:

i thought it was widely well known that many game code bases are horrors because a lot of it gets generated by (usually custom, but sometimes game maker and unity) tooling

it's because indie/small dev games are developed experimentally, regularly testing out new ideas and chunks. so investing in a big "correct" architecture ends up being a huge time sink, even though random people can look at the final process and go "i could do it neater than that"

i mean, so could the gamedev, if they knew they were going to write that in the first place.

the other thing is that games are rolled up like a big ball of mud. what starts as a two condition switch for events turns into a hundred as things get added to the game, and there really isn't much benefit to cleaning it up. when the game's done, you move on. it's only when people write their own engines that the tradeoff for better code up front makes any sense

well, it would if the people who write game engines ever get around to writing a game

Powerful Two-Hander
Mar 10, 2004

Mods please change my name to "Tooter Skeleton" TIA.


FlapYoJacks posted:

Who cares if undertales code is bad. It’s a good game.

10x programmer spotted

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003

tef posted:

it's because applications are developed experimentally, regularly testing out new ideas and chunks. so investing in a big "correct" architecture ends up being a huge time sink, even though random people can look at the final process and go "i could do it neater than that"

i mean, so could the application developer, if they knew they were going to write that in the first place.

the other thing is that applications are rolled up like a big ball of mud. what starts as a two condition switch for events turns into a hundred as things get added to the app, and there really isn't much benefit to cleaning it up. when the app's done, you move on. it's only when people write their own libraries that the tradeoff for better code up front makes any sense

well, it would if the people who write libraries ever get around to writing an app

Twerk from Home
Jan 17, 2009

This avatar brought to you by the 'save our dead gay forums' foundation.

tef posted:


well, it would if the people who write game engines ever get around to writing a game

It'd be awesome if Epic made a single player game to show off their awesome engine. Maybe they could even name the game after the engine?

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.
I bet it would take them about a fortnite

Adbot
ADBOT LOVES YOU

12 rats tied together
Sep 7, 2006

if you work at a place that has their own engine where they've done it "right" the engine will be so much code that you can't possibly check it all out at the same time or understand more than a fifth of it at once. also they wont have done it all right, some of it will be wrong, and other parts of it will be a different, mutually exclusive type of wrong

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply