r/ProgrammerHumor • • 27d ago

Meme searchAndReplace

Post image
4.6k Upvotes

257 comments sorted by

View all comments

30

u/ThatDudeFromPoland 27d ago

that's on you for not knowing how to use find and replace

30

u/creeper6530 27d ago

No, find and replace can misidentify, for example in comments.

Mature IDEs have a "rename symbol" though, usually F3, which actually parses the code and differentiates types from functions from variables per the language rules.

-15

u/Healthy-Form4057 27d ago

Um... that's on you for not knowing how to grep?

0

u/[deleted] 27d ago

[deleted] — view deleted comment

1

u/Brisngr368 27d ago

Vimgrep works surprisingly well in most cases

0

u/[deleted] 27d ago

[deleted] — view deleted comment

1

u/Brisngr368 27d ago edited 27d ago

Yeah... its bad isn't it.

I found it good for changing function APIs cause I can run a vim command on every match so I can get pretty complicated changes done.

Gemma's not bad for refactoring APIs though specially with a big ass test suite

2

u/thirdegree Violet security clearance 27d ago

Use a goddamn lsp please that's why they were invented

1

u/UUDDLRLRBadAlchemy 27d ago

While sed exists, no less

0

u/[deleted] 27d ago

[deleted] — view deleted comment

1

u/UUDDLRLRBadAlchemy 27d ago

No I don't run on tokens, this is basic computer usage

10

u/meneldal2 27d ago

Most languages can't be parsed with some regex

4

u/creeper6530 27d ago edited 27d ago

Most notably regex fails to pair nested parentheses and in a similar vein HTML tags.

https://youtu.be/MBpMYTTEvLU?t=692 if you want to learn the details 

2

u/meneldal2 27d ago

I can't really say too much because I have written a lot of parsing tools that using only regex but it's not on real programming languages. Thankfully excel doesn't (afaik) let you nest cells and you can do your parsing of one instruction per line (with parameters in other columns)

6

u/creeper6530 27d ago

Why would I arse myself with grep when I can literally press a single keybind, type a new name in and not worry about it renaming anything it's not supposed to?

I can legally type struct foo {}; let foo: foo; (declare a variable named foo of type of a struct named foo) and simple grep would take effort to rename only the variable without renaming the struct. Sure, it's not always an ideal pattern to do this, but it's legal.

1

u/DrMaxwellEdison 27d ago

Not a feasible use for grep or search of any kind. Point at the variable/function/class in the IDE, tell it to rename the symbol, watch it correctly and deterministically do that at every spot where that symbol is used in the code within a second. Ignores comments and unrelated objects of the same name, as well.

Claude would grep for it, too. And there's a fair chance it would do it wrong, plus it's a waste of time. More folks need to learn the tools they have available to them.

6

u/aaron2005X 27d ago

There is still the problem of finding a better name.

7

u/Wonderful-Habit-139 27d ago

So AI is thinking for you instead.

-1

u/LiifeRuiner 27d ago

That's the value proposition, yes

4

u/Wonderful-Habit-139 27d ago

So it's not a tool?

4

u/NotADamsel 27d ago

Recently, Rich Hickey (inventor of Clojure) penned an article where he made this exact case. He classifies AI as automation technology, not a tool. I think that he makes a pretty good argument.

1

u/Wonderful-Habit-139 27d ago

Thanks for sharing, looks interesting.

3

u/phl23 27d ago

Ye, but seriously who cares anymore. If you use ai anyway it doesn't matter. Just call it what you think it does with how many words you like with a case style of your choice.

2

u/countable3841 27d ago

Claude desktop doesn’t have find and replace though

1

u/Noisycarlos 26d ago

Or the LSP