this post was submitted on 01 Dec 2024
86 points (100.0% liked)

askchapo

22836 readers
110 users here now

Ask Hexbear is the place to ask and answer ~~thought-provoking~~ questions.

Rules:

  1. Posts must ask a question.

  2. If the question asked is serious, answer seriously.

  3. Questions where you want to learn more about socialism are allowed, but questions in bad faith are not.

  4. Try !feedback@hexbear.net if you're having questions about regarding moderation, site policy, the site itself, development, volunteering or the mod team.

founded 4 years ago
MODERATORS
 

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.

all 41 comments
sorted by: hot top controversial new old
[–] Yukiko@hexbear.net 67 points 1 month ago (6 children)

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.

[–] KobaCumTribute@hexbear.net 29 points 1 month 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@hexbear.net 29 points 1 month 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.

[–] Mardoniush@hexbear.net 24 points 1 month 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@hexbear.net 11 points 1 month 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@hexbear.net 7 points 1 month ago

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

[–] dannoffs@hexbear.net 33 points 1 month ago (1 children)

nobody knows how it works or how to fix it.

This is how all sufficiently complicated regex is.

[–] FunkyStuff@hexbear.net 17 points 1 month ago (1 children)

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@hexbear.net 2 points 1 month 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@hexbear.net 25 points 1 month 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@hexbear.net 22 points 1 month ago (1 children)

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@hexbear.net 6 points 1 month 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@hexbear.net 19 points 1 month 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.

[–] edge@hexbear.net 17 points 1 month ago (1 children)

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

[–] stink@lemmygrad.ml 4 points 1 month ago (1 children)

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@hexbear.net 2 points 1 month 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@hexbear.net 16 points 1 month ago (4 children)

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 15 points 1 month ago (1 children)

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@hexbear.net 7 points 1 month ago (1 children)

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 5 points 1 month 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

[–] stigsbandit34z@hexbear.net 5 points 1 month ago (2 children)

This sounds useful

How do I learn to do it

[–] Speaker@hexbear.net 8 points 1 month ago (2 children)

Read this for a very light introduction to the concept, then type "parser combinator library " into a search engine and never maintain a regular expression again!

[–] TheDoctor@hexbear.net 2 points 1 month ago (1 children)

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

[–] Speaker@hexbear.net 2 points 1 month 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@hexbear.net 3 points 1 month 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?

[–] comrade_pibb@hexbear.net 3 points 1 month ago

I've learned something new today

[–] Enjoyer_of_Games@hexbear.net 14 points 1 month ago
[–] Gorb@hexbear.net 14 points 1 month ago

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

[–] sewer_rat_420@hexbear.net 11 points 1 month ago

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

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.

[–] merthyr1831@lemmy.ml 9 points 1 month 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@hexbear.net 8 points 1 month 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.

[–] grandepequeno@hexbear.net 4 points 1 month ago

I'll be real, I use that shit so much for html it's not even funny

[–] Mardoniush@hexbear.net 2 points 1 month ago* (last edited 1 month ago)

It'll work but AI generally makes workable code that looks well formed but is in fact undocumented spaghetti code.

I would rely on it only for simple regex and even then only in non critical tasks. An AI is a particularly annoying intern and nothing more.

Of course these idiots are gonna use it to refactor segments of 50 year old legacy code originally written in FORTRAN.

Also you need to know regex for the same reason you need to know the fundamental theorem of calculus even though almost none ever needs it to actually solve anything.

[–] jjjalljs@ttrpg.network 2 points 1 month ago

$20/month doesn't include the externalized costs. Foolish take.

[–] tripartitegraph@hexbear.net 2 points 1 month ago

I use it to help me troubleshoot my python code, or give me a framework for some tedious data analysis stuff, but I always try to go back over it to make sure it's not fucking up somewhere I don't immediately see. I never use regex though, it could probably be pretty bad for that shrug-outta-hecks