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.

  • gay_king_prince_charles [she/her, he/him]
    ·
    8 hours ago

    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?

    Nobody knows how to fix human generated regex either so I think he's fine.

  • Yukiko [she/her]
    ·
    1 day 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.

    • Mardoniush [she/her]
      ·
      23 hours 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.

    • KobaCumTribute [she/her]
      ·
      1 day 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.

    • InevitableSwing [none/use name]
      hexagon
      ·
      1 day 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.

    • KoboldKomrade [he/him]
      ·
      23 hours 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.

    • SchillMenaker [he/him]
      ·
      24 hours ago

      Do you want a machine God? Because this is how you get a machine God.

  • KoboldKomrade [he/him]
    ·
    23 hours 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]
      ·
      18 hours 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.

  • underisk [none/use name]
    ·
    24 hours 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.

  • edge [he/him]
    ·
    23 hours ago

    AI generated regex sounds absolutely horrible. There’s no way that shit would work.

    • stink@lemmygrad.ml
      ·
      18 hours 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]
        ·
        2 hours 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.

  • dannoffs [he/him]
    ·
    1 day ago

    nobody knows how it works or how to fix it.

    This is how all sufficiently complicated regex is.

    • FunkyStuff [he/him]
      ·
      1 day 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]
        ·
        15 hours 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.

  • Barx [none/use name]
    ·
    1 day 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.

  • Speaker [e/em/eir]
    ·
    1 day 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
      ·
      1 day 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]
        ·
        1 day 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
          ·
          1 day 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

    • glans [it/its]
      ·
      19 hours 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?

      • Speaker [e/em/eir]
        ·
        1 day 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!

        • TheDoctor [they/them]
          ·
          23 hours ago

          How does this method handle backtracking? It seems like, as written, those functions wouldn’t handle it

          • Speaker [e/em/eir]
            ·
            21 hours 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.

  • Gorb [they/them]
    ·
    1 day ago

    I don't need AI to not know regex i simply refuse to learn it by choice

  • sewer_rat_420 [he/him, any]
    ·
    1 day ago

    Its going to hallucinate and do it wrong enough of the time that this fool will screw up any project he touches.

  • iByteABit [comrade/them]
    ·
    23 hours 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.

  • merthyr1831@lemmy.ml
    ·
    1 day 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.