YAML and TOML suck. Long live the FAMF!

  • JackbyDev@programming.dev
    link
    fedilink
    English
    arrow-up
    0
    ·
    2 months ago

    It’s a very interesting idea. I don’t think I’ll use it and I think the downsides outweigh the benefits but it is still an interesting idea.

    In all of these cases, the answer is not TOML, YAML or JSON — or FAMF for what it’s worth. It is goddamn database.

    I was about to boo and hiss, but if you mean something like sqlite as an application file format I’m more tempted to agree.

  • Rogue@feddit.uk
    link
    fedilink
    arrow-up
    0
    ·
    2 months ago

    I actually quite like this idea.

    You can take it a step further and use file extensions to determine the format. For example the parser would first search for title, and if it doesn’t exist try title.md title.html etc and render the content appropriately.

  • Hawk@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    0
    ·
    2 months ago

    This post misses the entire point of JSON/TOML/YAML and the big advantage it has over databases: readability.

    Using a file based approach sounds horrible. Context gets lost very easily, as I need to browse and match outputs of a ton of files to get the full picture, where the traditional methods allow me to see that nearly instantly.

    I also chuckled at the exact, horribly confusing example you give: upd_at. A metadata file for an object that already inherently has that metadata. It’s metadata on top of metadata, which makes it all the more confusing what the actual truth for the object is.

    • Perma@programming.devOP
      link
      fedilink
      arrow-up
      0
      ·
      2 months ago

      I know! right?

      Some say thay since you can use ‘tree’ and things like ranger to navigate the files, it should work alright. But I guess if you have one giant metadatafile for all the posts on your blog, it should be much easier to see the whole picture.

      As for upd_at, it does not contain information about when the files have been edited, but when the content of the post was meaningfully edited.

      So if for example I change the formatting of my times form ISO3339 to another standard, it changes the file metadata, but it does not update the post content, as far as the readers of the blog are concerned with. But I get why you chuckled.

        • Ferk@programming.dev
          link
          fedilink
          arrow-up
          0
          ·
          edit-2
          2 months ago

          For the record, you mention “the limitations of the number of inodes in Unix-like systems”, but this is not a limit in Unix, but a limit in filesystem formats (which also extends to Windows and other systems).

          So it depends more on what the filesystem is rather than the OS. A FAT32 partition can only hold 65,535 files (2^16), but both ext4 and NTFS can have up to 4,294,967,295 (2^32). If using Btrfs then it jumps to 18,446,744,073,709,551,615 (2^64).

  • Joël de Bruijn@lemmy.ml
    link
    fedilink
    arrow-up
    0
    ·
    2 months ago

    I like this … a lot.

    Is it new?

    If there isn’t even a todo task manager that handles notes this way, it is. Because man are there myriad implementations of that stuff.

    • Joël de Bruijn@lemmy.ml
      link
      fedilink
      arrow-up
      0
      ·
      2 months ago

      And like you said: all tooling for files works for this … For example I use F2 (highly recommended btw) for bulk editing filenames based on regex patterns. This could easily used to edit metadata in bulk.

      • Perma@programming.devOP
        link
        fedilink
        arrow-up
        0
        ·
        2 months ago

        Oh goody! F2 is great, but the developers are craaazy! They packages commandline Go application with npm!

        I also like vimv and vidir for simpler stuff.

  • Dark Arc@social.packetloss.gg
    link
    fedilink
    English
    arrow-up
    0
    ·
    2 months ago

    I’m a bit skeptical about the performance penalty. I know there’s a benchmark but I didn’t see any details of what was actually benchmarked and where. Windows (AFAIK) still has notoriously slow directory traversal operations. God forbid you’re using SSHFS or even NFS. I’ve seen things with hundreds of YAML nodes before.

    Benchmarking this is also tricky because the OS file cache will almost certainly make the second time faster than the first (and probably by a lot).

    Also just the usability… I think opening a file to change one value is extreme. You also still have the problem of documentation… Which sure you can solve by putting that in another file, but… You can also do that with just plain old JSON.

    I think in the majority of languages, writing a library to process these files would also be more complicated than writing a JSON parser or using an existing library.

    Also how do you handle trailing whitespace inserted by a text editor? Do you drop it? Keep it? It probably doesn’t matter as long as the configuration is just for a particular program. The program just needs to document it… But then you’ve got ambiguities between programs that you just don’t have to worry about with TOML or JSON.

    • Perma@programming.devOP
      link
      fedilink
      arrow-up
      0
      ·
      2 months ago

      OK so, you are very much right. You should definitely benchmark it using a simulation of what your data might look like. It should not be that hard. Just make script, that creates bunch of files similar to your data. About the trailing white space, when I am in terminal I just use sed to remove the latest ‘\n’ and in rust I just use .trim(), in go I think there is strings.trim(). It is honestly not that hard. The data structure and parser is not formed the same way as the json, where you have to parse the whole thing. So you don’t have to. You just open the files you need read their content. It is a bit more difficult at first since you can’t just translate a whole struct directly, but it pays for itself when you want to migrate the data to a new format. So if your structure never changes, probably those formats are easier.

  • mvirts@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    2 months ago

    I think a more clear name for this would be “filesystem data structures” since the key idea is editing structured data through the filesystem. I can imagine a FUSE driver that can map many types of data to this structure.

    • Ferk@programming.dev
      link
      fedilink
      arrow-up
      0
      ·
      edit-2
      2 months ago

      Yes… “metadata” is becoming an overused term. Not all data is metadata.

      My first thought when I read the title was about those .nfo files used by Kodi/Jellyfin and other media centers to keep information relative to the media files.

    • Perma@programming.devOP
      link
      fedilink
      arrow-up
      0
      ·
      2 months ago

      Yes. That is indeed a more interesting name. But think of the acronym.

      • FDS is not as easy to say FAMF.
      • FAMF already has an Urban Dictionary entry.
  • Kissaki@programming.dev
    link
    fedilink
    English
    arrow-up
    0
    ·
    2 months ago

    You can easily parse this using awk, sed, fzf,

    Well… I would know how to do it easily in C# or Nushell. But those tools? Maybe it’s easy when you’re already intuitively familiar with them. But line/string splitting seems anything but with complex utils like that with many params and a custom syntax.

    • Ferk@programming.dev
      link
      fedilink
      arrow-up
      0
      ·
      edit-2
      2 months ago

      That quote was in the context of simply separating values with newlines (and the list also included “your language’s split or lines function”).

      Technically you don’t even need awk/sed/fzf, just a loop in bash doing read would allow you to parse the input one line at a time.

      while read line; do 
         echo $line # or whatever other operation
      done < whateverfile
      

      Also, those manpages are a lot less complex than the documentation for C# or Nushell (or bash itself), although maybe working with C#/nushell/bash is “easy when you’re already intuitively familiar with them”. I think the point was precisely the fact that doing that is easy in many different contexts because it’s a relatively simple way to separate values.

      • Kissaki@programming.dev
        link
        fedilink
        English
        arrow-up
        0
        ·
        2 months ago

        Yeah, I see they did mention “your languages functions”. It’s just, subjectively, reading awk and sed next to “easily” irritates me. Because I’ve never found it easy to get into those.