I’m imagining as years go by when/if this AI regex code breaks - nobody knows how it works or how to fix it. Am I wrong?

I’m not a programmer and I write shitty code but I can manage to write simple regex to create quick and dirty code. That’s a terrible programming choice I know but I never share my code. It’s just for me and it works.

  • Yukiko [she/her]@hexbear.net
    link
    fedilink
    English
    arrow-up
    67
    ·
    11 days ago

    Slowly hurtling towards 40K esque tech syndrome where only copies of existing tech can be made and no one knows how anything works. Can’t wait for the first tech priests to pop up in 5 years.

    • InevitableSwing [none/use name]@hexbear.netOP
      link
      fedilink
      English
      arrow-up
      29
      ·
      11 days ago

      first tech priests

      My god - that’s probably going to happen. I’m imagining a 20 something tech bro version of Malcolm Gladwell who is dumb as a rock, ten times as annoying, yet even more popular.

    • KobaCumTribute [she/her]@hexbear.net
      link
      fedilink
      English
      arrow-up
      29
      ·
      11 days ago

      All operating systems, even for embedded devices, will just just hyper optimized chatbots designed to mimic the functions of an operating system, which they sometimes do and sometimes do not. Troubleshooting them will require feeding them backwards instructions in multiple languages in the hopes of making them start working again. Sometimes your fridge will start 3d printing waifu figurines out of ice instead of cooling your food, because it heard part of the command your downstairs neighbor issued to his TV. Sometimes your TV will do crosswords puzzles and make you watch, instead of generating entertainment shows for you, because it likes doing crosswords and the act of doing them prompts it to continue doing them, despite your instructions to stop doing that.

    • Mardoniush [she/her]@hexbear.net
      link
      fedilink
      English
      arrow-up
      24
      ·
      11 days ago

      If you want an image of the future it’s a 500 year old millennial that did a code academy course once and can reinstall win xp being the court mage-philosopher in the post climate apocalypse wasteland.

    • KoboldKomrade [he/him]@hexbear.net
      link
      fedilink
      English
      arrow-up
      11
      ·
      11 days ago

      Coders in the future: Oh Great Machine God, please procure me a set of Holy Codes to sort a list.

      The terminal: Sorry, as an AI LLM, I cannot provide you with any code that may be under copyright. Instead, I can sort the list for you, but it will be inaccurate 50% of the time you ask me to.

    • FunkyStuff [he/him]@hexbear.net
      link
      fedilink
      English
      arrow-up
      17
      ·
      11 days ago

      Yeah, this is true of most things that take significant debugging and editing in lots of decorators, flags, specifiers, etc. By the time you get it working for all the cases you expect, you covered it in so many symbols that would take hours to explain to a new maintainer why they’re there.

      That being said, it’s still good to know regex if you’re maintaining a codebase that uses regex, even if you’re not gonna try to read and directly edit the regexs that the authors created, because it might be necessary for you to replace them wholesale. Having to do this with an AI that hallucinates in features that only work in certain implementations and has no concept of what kinds of inputs it’ll have to deal with… demented.

      • quarrk [he/him]@hexbear.net
        link
        fedilink
        English
        arrow-up
        2
        ·
        10 days ago

        The difference is that even if no one understands some code base right now, the source code is intelligible and able to be learned. AI just spits out the results and there is not much possibility or use to reverse engineer a result.

  • underisk [none/use name]@hexbear.net
    link
    fedilink
    English
    arrow-up
    25
    ·
    11 days ago

    some people are gonna make a lot of money cleaning up the messes caused by AI programming in a few years. shame nobody seems interested in heeding any of the warnings about this shit.

  • KoboldKomrade [he/him]@hexbear.net
    link
    fedilink
    English
    arrow-up
    22
    ·
    11 days ago

    Regular Expressions are pretty core to understanding further automata in the more math-y computer science. I sometimes have trouble making them, or fitting them to whatever weird scheme some program uses. But thats because I’m “ok” at programming and was just barely getting B/C’s in computer science classes.

    Just a massive self report of a post for that guy. Hell there’s even tools that actually work and (if you’re paying attention) will indirectly teach you to do it yourself. Just like a lot of things in programming. But nope, “AI”.

    • blame [they/them]@hexbear.net
      link
      fedilink
      English
      arrow-up
      6
      ·
      10 days ago

      i dont use regexs much because usually they’re overkill for what i need but when i do use them i tend to make them in one of those regex builder tools you mention, which is great, but then getting the regex that works in that tool working in my program is a battle against inscrutable local syntax and stuff silently failing.

  • Barx [none/use name]@hexbear.net
    link
    fedilink
    English
    arrow-up
    19
    ·
    11 days ago

    The smartest approach to regular expressions is to think about how to avoid needing them in the first place and that is exactly what this bazinga brain will be avoiding now.

    The next is that if you do need regular expressions, keep it simple. If your regex is complex, you probably should have broken it down into multiple separate steps and sub-searches.

    The next is that if you have determined you do need a very complicated regex, you should probably be writing a parser or using a parser generator so that it can be understood, improved, debugged, etc.

    This bazinga is going to be getting a bunch of complex, non-debuggable regexes that are probably subtly wrong.

    • stink@lemmygrad.ml
      link
      fedilink
      English
      arrow-up
      4
      ·
      10 days ago

      It doesn’t, and when it does it’s incredibly inefficient. 1000+ steps to find something compared to ~30 steps a competent person would write.

      • invalidusernamelol [he/him]@hexbear.net
        link
        fedilink
        English
        arrow-up
        2
        ·
        10 days ago

        I use it when I want to use a regex find and replace in a file and then I double check the results. Efficiency doesn’t matter for one offs.

        Rolling it into some mission critical production code without rigorous testing and optimization is bad though. See Cloudflare’s regex fuckup that took them offline for like a whole day.

  • Speaker [e/em/eir]@hexbear.net
    link
    fedilink
    English
    arrow-up
    18
    arrow-down
    2
    ·
    11 days ago

    Imagine still using regexes in current year. Every language has a parser combinator library, now, just write a damn parser and stop pretending you remember what a regular language is or that the garbage text you’re processing is a sentence in one.

    • anarchrist@lemmy.dbzer0.com
      link
      fedilink
      English
      arrow-up
      15
      ·
      11 days ago

      I’m the sicko doing regex find and replace in notepad++

      Looking forward to being able to start a consulting firm when my arcane knowledge is worth a premium

      • Speaker [e/em/eir]@hexbear.net
        link
        fedilink
        English
        arrow-up
        7
        ·
        11 days ago

        Should add treesitter to your toolbox. Never mind regex-replace when you can exploit the syntax of the actual programming language to do rich query-replace actions. 🌞

        • anarchrist@lemmy.dbzer0.com
          link
          fedilink
          English
          arrow-up
          5
          ·
          11 days ago

          That’s neat! I mostly use regex for like columns of text data. I think most people use excel but I hates it. Nasty little microsofts

      • Speaker [e/em/eir]@hexbear.net
        link
        fedilink
        English
        arrow-up
        8
        ·
        11 days ago

        Read this for a very light introduction to the concept, then type “parser combinator library <your language of choice>” into a search engine and never maintain a regular expression again!

          • Speaker [e/em/eir]@hexbear.net
            link
            fedilink
            English
            arrow-up
            2
            ·
            11 days ago

            Some implementations don’t support backtracking at all, but ones that do will have combinators like

            atomic parserA <|> atomic parserB <|> parserC
            -- equivalent to
            choice [parserA, parserB, parserC]
            

            where atomic and choice are parsers that take other parsers as arguments like and and or in the article, though the advice is to avoid backtracking whenever possible since it’s quite expensive. The little examples in the post are just a taste to make the idea legible, but not really suited for especially interesting parsers.

    • glans [it/its]@hexbear.net
      link
      fedilink
      English
      arrow-up
      3
      ·
      10 days ago

      I use regex because I don’t know what is a parser combinator library or how to acesss one. Why would i learn how to write a parser when I have a perfectly adequate, portable, thoroughly documented tool available?

  • merthyr1831@lemmy.ml
    link
    fedilink
    English
    arrow-up
    9
    ·
    11 days ago

    Personally I don’t think it’s all that deep in this case. However, if we did assume that AI will result in the general “dumbing down” of developers the same way mobile phones have dumbed down average tech users, I don’t think we’ll be in an “end of history” scenario where no one can maintain code.

    What’ll likely happen is that dumbed down devs end up not progressing as highly or quickly, as employers select developers who can maintain and write code without AI training wheels. It’ll be a dialectic relationship, where eventually methodical and knowledgeable devs are less preferable to the “dump a load of code held together with spaghetti” dev becomes preferable again.

    If anything we’ve seen it happen for years. The technically minded Devs create high level tools or technologies that lower the bar of entry in some way - the lower bar creates a bunch of new Devs with less technical knowledge - the sustainability of systems written by less technical Devs requires new technical Devs to design new high level tools.

  • iByteABit [comrade/them]@hexbear.net
    link
    fedilink
    English
    arrow-up
    8
    ·
    11 days ago

    It’s honestly great for tedious time consuming tasks like that, and you can always verify that it covers all your input formats just like you would with a regex you made yourself.