• 21 Posts
  • 1.39K Comments
Joined 6 years ago
cake
Cake day: May 31st, 2020

help-circle
  • Ephera@lemmy.mltoProgrammer Humor@lemmy.mlTOML
    link
    fedilink
    English
    arrow-up
    1
    ·
    15 hours ago

    I can understand the sentiment and would 100% agree for programming languages.
    But personally I actually like that it encourages a flat structure, because you do not want to be yakshaving the structure of your config file. Too much nesting means you will sooner or later run into configuration keys being nested under the wrong category, because your project context changed over time.

    And well, as I’ve argued in a few other comments already, I think non-techie users have a disproportionally simpler time when no nesting is used. They understand the concept of a heading and then just adding a line underneath the appropriate heading is really intuitive.
    You can just tell them to add the line certificate="/tmp/cert.crt" under [network.tls] and they will find a line in their config file which actually reads [network.tls] and they can just paste that line as-is.

    With nesting, they’d need to add it under here:

    network: {
        tls: {
            certificate: "/tmp/cert.crt"
        }
    }
    

    Which means:

    • You need some awkward explanation where they should nest it, or an explanation that e.g. “network.tls” translates to nesting.
    • They will ask whether they should indent the line you sent them.
    • Well, and it’s also surprisingly difficult to explain between which braces they should put the text, and that’s at the end of the braces, but not after the braces etc., if you’re talking to them on a call.

    It’s not even that I’m completely enamored with TOML, but this aspect is certainly growing on me…


  • I’m always surprised to hear people believe in ghosts, not because I consider it particularly ridiculous, but rather because ghosts have no relevance in my life. I don’t need them to exist to explain what’s happening around me.

    Every few years or so, I might hear a noise where I don’t have an explanation, but that always feels adequately explained by me not knowing things. I’m constantly surrounded by living beings as well as materials that are subject to gravity, temperature, humidity etc.. Occasionally, they’ll make noises quite naturally.


  • Their point is that one could come up with a billion hypotheticals for what might theoretically exist, because we cannot disprove it. If we spent as much time humming and hawing whether each one actually does exist as we do for ghosts, souls, gods, Big Foot etc., then you won’t be doing anything else in life.
    That’s why it’s a typical position to just say that they don’t exist until proven otherwise.

    Or in the more general sense, this is Occam’s Razor: If there’s multiple possible explanations for something, then one should assume the simplest explanation until proven otherwise.
    And if you hear a door slamming shut in your house, then wind is a much simpler explanation than ghosts.


  • Ephera@lemmy.mltoProgrammer Humor@lemmy.mlTOML
    link
    fedilink
    English
    arrow-up
    2
    ·
    2 days ago

    VSCode is Electron, i.e. a webpage, so it’s not hugely surprising that they opted for the natively supported JavaScript Object Notation. And also shows that they don’t care for using the right tool for the job to begin with.

    Personally, I much prefer TOML over YAML, because it does not have significant whitespace, and because you can read the spec in a reasonable amount of time. It just has so much less complexity, while still covering the vast majority of use-cases perfectly well.


  • Ephera@lemmy.mltoProgrammer Humor@lemmy.mlTOML
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    2 days ago

    We just document that this is how you write the config file:

    [network]
    bind.host = "127.0.0.1"
    bind.port = 1234
    
    # etc.
    

    And that seems straightforward enough. Yeah, technically users can opt to use inline tables or raw strings or whatever, but they don’t have to.


  • Ephera@lemmy.mltoProgrammer Humor@lemmy.mlTOML
    link
    fedilink
    English
    arrow-up
    4
    ·
    2 days ago

    Well, you can still decide how much of the TOML features you actually use in your specific application. For example, I’m currently involved in two projects at $DAYJOB where we read TOML configurations and we don’t make use of the inline tables that OP memes about in either of them.

    Ultimately, the big advantage of TOML over INI is that it standardizes all kinds of small INI extensions that folks have come up with over the decades. As such, it has a formal specification and in particular only one specification.
    You can assume that you can read the same TOML file from two different programming languages, which you cannot just assume for INI.



  • Ephera@lemmy.mltoProgrammer Humor@lemmy.mlTOML
    link
    fedilink
    English
    arrow-up
    38
    ·
    edit-2
    3 days ago

    Counterpoints:

    • TOML is intended for configuration, not for data serialization, so you shouldn’t be sending it over the wire in all too crazy ways anyways.
    • Most protocols will have a built-in way of knowing when the whole content has been transferred, typically by putting a content length into the header.
    • Having to wait until the closing } or ] can also be a disadvantage of JSON, since you cannot stream it, i.e. start processing the fields/elements before the whole thing has arrived. (You probably still don’t want to use TOML for that, though. JSONL, CSV or such are a better idea.)

  • Ephera@lemmy.mltoProgrammer Humor@lemmy.mlTOML
    link
    fedilink
    English
    arrow-up
    3
    ·
    3 days ago

    Well, TOML is essentially just an extension of the INI format (which helped its adoption quite a bit, since you could just fork INI parsers for all kinds of programming languages).

    And then, yeah, flattening everything is kind of baked into INI, where it arguably made more sense.
    Although, I do also feel like non-techies fare better with flat files, since they don’t have to understand where into the structure they have to insert the value. They just need find the right “heading” to put the line under, which is something they’re familiar with.






  • Most developers I’ve looked at would happily just paste the curl|bash thing into the terminal.

    I mean, I typically see it used for installing applications, and so long as TLS is used for the download, I’m still not aware of a good reason why you should check the Bash script in particular in that case, since the application itself could just as well be malware.

    Of course, it’s better to check the Bash script than to not check it, but at that point we should also advise to download the source code for the application, review it and then compile it yourself.
    At some point, you just have to bite the bullet and I have not yet seen a good argument why the Bash script deserves special treatment here…

    Having said that, for cases where you’re not installing an application, yeah, reviewing the script allows you to use it, without having to trust the source to the same degree as you do for installing an application.


  • One thing that will become important pretty quick if you continue making these scripts is that it’s almost always better to wrap your variables in quotes - so it becomes yt-dlp -x “$a.

    Oh man, this reminds me of the joke that any program that’s more complex than Hello World has bugs – and folks still don’t even agree how to spell “Hello, World!”.

    Of course, Bash is a particular minefield in this regard…





  • Ephera@lemmy.mltoLinux@lemmy.mlKDE Plasma 6.6 released
    link
    fedilink
    English
    arrow-up
    1
    ·
    9 days ago

    Yeah, I’ve done that occasionally, too, but it adds a load of friction for moving windows between screens, in particular also when un-/replugging the screen, so it’s still painful enough that I don’t bother with a second screen.

    I guess, it also plays a role that I do use lots of workspaces, so it’s 1) extra painful and 2) I don’t have as big of a need for a second screen, since I can just switch out what first screen displays very quickly.