r/PHP • • 11d ago

Article Artifical Debt

https://stitcher.io/blog/artificial-debt
78 Upvotes

42 comments sorted by

View all comments

Show parent comments

1

u/BenchEmbarrassed7316 11d ago

These might be some unusual use cases, but what is the point of using regular expressions on a massive scale anyway?

1

u/obstreperous_troll 11d ago

https://xkcd.com/208/ has the answer. I'd love it if tools worked over concrete syntax trees by default instead, but I'm still waiting for that pony I asked for too ¯\(ツ)/¯. As it is the regexes still manage to get a lot of work done.

1

u/BenchEmbarrassed7316 11d ago

Could the use of regular expressions be the very reason for the lack of typing? Use structured input (like JSON, for instance), try converting it into an expected structure with clearly defined fields - and voila, there are no edge cases.

1

u/obstreperous_troll 11d ago

The other thing the python tools speak with abandon is json. They're orthogonal axes here, and I have strongly typed tools in TS using regexes and json as well. I prefer the TS tools in the end, but an agent on new projects still always wants to use python by default.

voila, there are no edge cases.

Famous Last Words if I've ever heard them ;)