top 83 comments

sorted by: hot top controversial new old
[–] 167 points 8 months ago (8 children)
orange = {
    you = "glad",
    I = {
        didn\'t = {
            say = "banana"
        }
    }
}
  • source
  • hideshow 8 child comments
  • [–] 22 points 8 months ago (7 children)

    I was such a menace with this joke as a child. Haha

  • source
  • parent
  • hideshow 7 child comments
  • [–] 12 points 8 months ago (6 children)

    I wish I could hear it again for the first time, top 10 knock knock joke

  • source
  • parent
  • hideshow 6 child comments
  • [–] 7 points 8 months ago (5 children)

    Reminds me of a good knock knock joke, but you have to start it

  • source
  • parent
  • hideshow 5 child comments
  • [–] 5 points 8 months ago (4 children)
  • [–] 209 points 8 months ago (34 children)
  • [–] 40 points 8 months ago

    Well...

    It's name-value pairs, with groups denoted by balanced brackets. It's close to as good as you can get for one kind of data serialization.

    What is impressive is how many problems people manage to fit in something so small.

  • source
  • parent
  • [–] 78 points 8 months ago (9 children)

    Chuck in comments and I'm on board.

  • source
  • parent
  • hideshow 9 child comments
  • [–] 90 points 8 months ago (4 children)

    If we’re adding comments to json, can we add canonical support for trailing commas?

  • source
  • parent
  • hideshow 4 child comments
  • [–] 28 points 8 months ago (3 children)
  • [–] 42 points 8 months ago (2 children)

    Oh, a trailing comma? That’s a tuple.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 34 points 8 months ago (6 children)

    What's it called when people try to reinvent Lisp for the hundredth time?

  • source
  • parent
  • hideshow 6 child comments
  • [–] 54 points 8 months ago (2 children)
  • [–] 3 points 8 months ago* (last edited 8 months ago)

    Not many people realise this, but Hanibal's dad Hamilcar Barca had a lisp, and used his knowledge of abstract syntax trees and delayed execution to deforest parts of the Himalayas in order to let his elephant of a son through.

  • source
  • parent
  • [–] 9 points 8 months ago (2 children)
  • [–] 2 points 8 months ago (1 child)

    Funny thing, Lisp structures are converted pretty easily to xml/html, so of course there are packages for Lisp varieties allowing one to write html in Lisp. (Similar to Pug, but with parentheses.)

  • source
  • parent
  • hideshow 1 child comment
  • [–] 6 points 8 months ago (14 children)

    That’s not JSON. Note the use of equal signs for the property names. That’s something else.

  • source
  • parent
  • hideshow 14 child comments
  • [–] 42 points 8 months ago (2 children)

    Carcinisation is the phenomenon of non crabs to evolve crab like characteristics. It is not the process of non crabs becoming true crabs.

    In this case the language is trending toward JSON syntax, but it doesn't have to actually be JSON for carcinisation to be an applicable analogy.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 22 points 8 months ago* (10 children)

    Equals schmequals.
    It could be a ⇨ and it would be the same as JSON because it is still a single symbol used as a separator.

    a distinction without a difference

    Now, if it took multiple separators, each giving some specific different meaning, then it would be a something else.

  • source
  • parent
  • hideshow 10 child comments
  • [–] 3 points 8 months ago (3 children)

    It could be a ⇨ and it would be the same as JSON because it is still a single symbol used as a separator.

    Nah, that's a Ruby Hash...

  • source
  • parent
  • hideshow 3 child comments
  • [+] -6 points 8 months ago (5 children)

    None of what you said makes any sense.

    This is the equivalent of an anti-vaxxer denouncing vaccines because they feel that their herbs are close enough to real medicine. 🤦‍♂️

    Don’t do that. Syntax absolutely matters.

  • source
  • parent
  • hideshow 5 child comments
  • [+] -7 points 8 months ago* (last edited 8 months ago) (4 children)
    #define EQUAL_TO =
    

    Look! I made a new programming language!


    1. Vaccines are not medicine. They are a more refined form of older (much dirtier and dangerous) practices of sharing sick people's blood to create group immunity. I'm pretty thankful of not having to do the latter.
    2. No, herbs are far from factory produced, chemically engineered medicine.
    • Most usages of herbs are defined in a way that it acts much closer to cooking. Also most of the herbs used in everyday cooking have medicinal and detoxifying properties, which is 1 of the ways food recipes have developed the way they do.
    • Herbal medicine is much milder than the extremely refined medicine produced using modern methods
      • Hence, they are much slower to act and you need to be using them much earlier than what you can manage with modern ones
      • Hence, there is much less overdose related problems
    • Most herbal medicine tend to have multiple effects. This is in contrast with modern medicine, where extra effects tend to be mostly undesirable and detrimental
      • Hence, herbal medicine is a better choice for regular, low intensity problems, like the flu and what-not, rather than popping Paracetamol every time your temp goes 1℉ over the baseline.
    • Herbal medicine works along with nutrition. This means, it is much harder to develop a tolerance to it in a way that would make it harder for it to work in the future.
  • source
  • parent
  • hideshow 4 child comments
  • [–] 3 points 8 months ago (3 children)

    You seem to have had something like mint and thyme in mind as an example of herbal medicine, but try to substitute something like marijuana and nightshade to see that your description doesn't fit all of the herbs. The only thing I agree is that effects often come coupled and you have to do something to isolate necessary ones.

  • source
  • parent
  • hideshow 3 child comments
  • [–] -1 points 8 months ago (2 children)

    While marijuana and nightshade (and coffee) would be herbal "medicine" substitute for MDMA, DMT, nicotine, cocaine etc,
    the others you mentioned would be a substitute for Chlorpheniramine Maleate, phenylpropanolamine and the likes.

    So if a herbal medicine doctor is prescribing you marijuana for cough and cold, you can perhaps consider it being a quack. Same for someone prescribing SSRIs to a functioning adult that works 40 hours a week, on their first visit.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 2 points 8 months ago (1 child)

    My point was more along the lines that herbal doesn't mean safe, mild, slow, etc

  • source
  • parent
  • hideshow 1 child comment
  • [–] -3 points 8 months ago

    It would definitely be milder and slower.
    Safe? Nothing is.

    If you want to fuck with your brain, then doesn't matter whether you choose poppy seeds or IV its refined chemical. You will still fuck your brain.
    And coffee is pretty much an addiction.

    The difference is that with the former, you would at least know what is happening to you before you turn yourself into an invalid.
    And for those who said they didn't know what was happening... No. Your body gave you the signs and you decided to ignore them.

    Allopathic drugs are measured in mg and some even in µg, while you will see ayurvedic stuff being talked about in grams or tens of grams, simply because they are less refined.

  • source
  • parent
  • [–] 94 points 8 months ago (21 children)

    If yaml didn’t have anchors and 8 different white space formats, it’d be a great replacement for this kind of thing.

    But yaml is a mess, and you’d think you could parse it easily, but you can’t.

  • source
  • hideshow 21 child comments
  • [–] 37 points 8 months ago (3 children)

    As someone who works with YAML regularly:

    Fuck YAML.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 1 point 8 months ago (1 child)

    Nah, yaml isn't great by virtue of itself but with what it competes with. I far, far prefer it to any other BS. Json is garbage for human creation and obviously toml due to above. XML... Obviously just for machines.

    Again, only good because of its competition.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 58 points 8 months ago (4 children)

    YAML is redeemed by one thing only:

    All JSON is valid YAML.

  • source
  • parent
  • hideshow 4 child comments
  • [–] 12 points 8 months ago (3 children)

    No way. You're telling me I can just write json instead?

  • source
  • parent
  • hideshow 3 child comments
  • [–] 13 points 8 months ago (2 children)

    Yup! YAML is defined as a "strict superset" of JSON (or at least, it was the last time I checked).

    It's a lot like markdown and HTML; when you want to write something deeply structured and somewhat complex you can always drop back/down to the format with explicit closing delimiters and it just works™.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 17 points 8 months ago (4 children)

    I have a fundamental disdain for formats with restrictive white space definitions (I’m looking too at you Python)

  • source
  • parent
  • hideshow 4 child comments
  • [–] 15 points 8 months ago (3 children)

    I’ve never had this issue with Python, but makefile has given me plenty of whitespace issues.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 3 points 8 months ago (3 children)

    I'm a fan of NestedText. It's no panacea but I'd argue it's the most well-considered and useful file format for structured data in plain text.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 86 points 8 months ago (16 children)
  • [–] 36 points 8 months ago (10 children)

    The json spec is not versioned. There were two changes to it in 2005 (the removal of comments

    See, this is why we can't have nice things.

  • source
  • parent
  • hideshow 10 child comments
  • [–] 17 points 8 months ago (9 children)

    I can kind of understand it after having to work with an XML file where users encoded data into comments for no good reason. But yeah, it does make JSON awkward for lots of potential use-cases.

  • source
  • parent
  • hideshow 9 child comments
  • [–] 8 points 8 months ago (4 children)
  • [–] 9 points 8 months ago

    They're not supposed to contain data, but some parsers will allow you to access what's written into comments. And so, of course, someone made use of that and I had to extract what was encoded basically like that:

    <!--
        Host: toaster,
        Location: moon,
    -->
    <data>Actual XML follows...</data>
    

    My best guess is that they added this data into comments rather than child nodes or attributes, because they were worried some of the programs using this XML would not be able to handle an extension of the format.

  • source
  • parent
  • [–] 5 points 8 months ago (2 children)

    They are useful metadata important to the longterm lifespan of the codebase

  • source
  • parent
  • hideshow 2 child comments
  • [–] 7 points 8 months ago (1 child)

    That's why they make sense in code and config files. JSON is neither, despite the insistence of far too many people to write configuration in it.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 5 points 8 months ago*

    In an ideal world, yes. In a locked down world where you have access only to 1/4 the codebase or your job is more ontology-focused, all you have access to might be the JSON. Leaving a comment or two about why a particular value or hierarchy is as it is is sometimes more clear than writing up a seperate README that no one will read

  • source
  • parent
  • [–] 1 point 8 months ago (2 children)

    Anything can be abused. That’s not a legitimate reason to take away perfectly reasonable features. Looking at you, Java (unsigned integers).

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 8 months ago (1 child)

    Well, I assume they had other concerns, too. For example, it adds a bunch of complexity for reformatting a JSON from single-line to pretty-print, if comments can appear in there. I'm certainly not saying that I'm always best friends with the decision to remove comments, just that I can somewhat understand it.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 1 point 8 months ago

    Their stated justification is that people would abuse comments, using them to carry semantic or syntactic information. That’s a shit justification IMO.

    As far as the additional complexity that comments bring, I understand that from a technical perspective but from an engineering-for-real-humans-in-the-real-world perspective that’s the kind of thing you just have to deal with if you want to design a good format.

  • source
  • parent
  • [–] 5 points 8 months ago (2 children)

    Almost all of those issues are solved by explicitly quoting your strings, the author even acknowledges that. Yeah it's annoying that yaml lets you do otherwise, but the title is a bit dramatic.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 3 points 8 months ago* (last edited 8 months ago)

    Coming from powershell scripting, every string is put in quotes and to be printed strings with variables are put in $($var) (e.g. Write-Host "Example-Issue: $($IssueVariable)")
    Saves me the trouble of hoping that $IssueVariable isnt interpreted as a string butbas a variable by PowerShell.

  • source
  • parent
  • [–] 1 point 8 months ago

    Or by configuring your parser.

    I do agree there are plenty of annoyances that shouldn't exist in YAML but do because someone had an opinionated belief at one point, though. For example, it shouldn't try to guess that "yes", "no", "y", and "n" are truthy values. Let the programmer handle that. If they write true/false, then go ahead and consider those truthy. Times can also be a bit of a pain - iirc writing 12:00 is supposed to be interpreted as 0.5 - but at least that's something you can work around.

    But there's plenty in that article that are only problems because the writer made them problems. Every language lets you make mistakes, markup languages aren't any different. It's not a bad thing that you can write strings without quotes. It's not forcing you to do so. Anchors also make it simple to reuse YAML and they're completely optional. The issue with numbers (1.2 stays as 1.2 while 1.2.3 becomes "1.2.3" is very nitpicky. It's completely reasonable for it to try to treat numbers as numbers where it can. If type conversion is that big of an issue for you, then I really doubt you know what you're doing.

    On top of all this, YAML is just a superset of JSON. You can literally just paste JSON into your YAML file and it'll process it just fine.

    I'm not saying it's perfect, but if you want something that's easy to read and write, even for people who aren't techy, YAML is probably the best option.

  • source
  • parent
  • load more comments
    view more: next ›
    30 comments in c/programmerhumor@lemmy.ml view that post