• MTK@lemmy.world
    link
    fedilink
    arrow-up
    10
    ·
    3 hours ago

    Error handling should only be with “if”

    Variable names must be generic and similar to each-other

    Debugging is only done with prints

    Version numbers must be incoherent, hard to order correctly, contain letters and jump in ways that don’t align with the updates done.

      • xmunk@sh.itjust.works
        link
        fedilink
        arrow-up
        1
        ·
        3 hours ago

        Hey now, you know that according to the Bible the biggest number is a million. Anything larger than that including infinity is some of that “woke shit”.

        Your array will be 999,999, 999,998, 999,997 …

      • UndercoverUlrikHD@programming.dev
        link
        fedilink
        arrow-up
        2
        ·
        4 hours ago

        Writing Lua code that also interacts with C code that uses 0 indexing is an awful experience. Annoys me to this day even though haven’t used it for 2 years

        • pelya@lemmy.world
          link
          fedilink
          arrow-up
          11
          ·
          6 hours ago

          In Lua all arrays are just dictionaries with integer keys, a[0] will work just fine. It’s just that all built-in functions will expect arrays that start with index 1.

          • frezik@midwest.social
            link
            fedilink
            arrow-up
            1
            ·
            11 minutes ago

            PHP did that same thing. It was a big problem when algorithmic complexity attacks were discovered. It took PHP years to integrate an effective solution that didn’t break everything.

          • my_hat_stinks@programming.dev
            link
            fedilink
            arrow-up
            2
            ·
            3 hours ago

            That’s slightly misleading, I think. There are no arrays in Lua, every Lua data structure is a table (sometimes pretending to be something else) and you can have anything as a key as long as it’s not nil. There’s also no integers, Lua only has a single number type which is floating point. This is perfectly valid:

            local tbl = {}
            local f = function() error(":(") end
            
            tbl[tbl] = tbl
            tbl[f] = tbl
            tbl["tbl"] = tbl
            
            print(tbl)
            -- table: 0x557a907f0f40
            print(tbl[tbl], tbl[f], tbl["tbl"])
            -- table: 0x557a907f0f40	table: 0x557a907f0f40	table: 0x557a907f0f40
            
            for key,value in pairs(tbl) do
              print(key, "=", value)
            end
            -- tbl	=	table: 0x557a907f0f40
            -- function: 0x557a907edff0	=	table: 0x557a907f0f40
            -- table: 0x557a907f0f40	=	table: 0x557a907f0f40
            
            print(type(1), type(-0.5), type(math.pi), type(math.maxinteger))
            -- number	number	number	number
            
            • Sonotsugipaa@lemmy.dbzer0.com
              link
              fedilink
              English
              arrow-up
              16
              ·
              7 hours ago

              Lua - Portuguese feminine noun for “moon”, coming from the Latin “luna”
              Luna - Latin, feminine noun (coincidentally identical to the Italian noun, also feminine)

              Yup, Lua is a girl.

    • lefixxx@lemmy.world
      link
      fedilink
      arrow-up
      1
      arrow-down
      7
      ·
      7 hours ago

      How is arrays starting at 1 still a controversial take. Arrays should start at 1 and offsets at 0.

      • Traister101@lemmy.today
        link
        fedilink
        arrow-up
        3
        ·
        7 hours ago

        So what’s 0 do then? I’m okay with wacky indexes (I’ve used something with negative indexes for a end-index shorthand) but 0 has to mean something that’s actually useful. Using the index as the offset into the array seems to be the most useful way to index them.

  • db0@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    16
    arrow-down
    1
    ·
    8 hours ago

    NGL, this kind of form of putting the decisions the monkey-in-charge is making in a way experts in a field will understand, is a very good way to showcase the absurdity.

    • NABDad@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      5 hours ago

      Are there really people capable of understanding this who aren’t capable of understanding, for example, “tariffs increase inflation”?

  • notabot@lemm.ee
    link
    fedilink
    arrow-up
    6
    ·
    8 hours ago

    I started reading that from the top and got increasingly angry on the way down. That creature is a monster.

  • tgm@lemmy.world
    link
    fedilink
    English
    arrow-up
    7
    ·
    8 hours ago

    Haven’t heard of the stack address thing, anyone got a TLDR on the topic?