3 ms·
I don't like this API. Overall I dislike the shift away from a URL as a language-agnostic string primitive to some weird convoluted object which is limited to
by socketcluster 9mo ago
I don't like this API.
Overall I dislike the shift away from a URL as a language-agnostic string primitive to some weird convoluted object which is limited to specific use cases.
URL literally stands for Universal Resource Locator... A string is Universal. It can be passed around easily between processes, it can be easily stored in a database, it can be easily shared online, it can be easily passed to an LLM... URLs were supported by LLMs before LLMs even existed! You've got to appreciate that!
This class they call URL is actually not a URL at all, it's more like a bound URLParser or URLExtractor.
A URL is a string that's a fact. Even ask Google; "is a URL a string?" it will say yes.
The idea of a URL instance as a language-specific construct is a bad idea. It's one of the reasons why many people don't like Java.
[EDIT] I don't dislike this API though it initially triggered my Java PTSD as I mistakenly thought it built on TOP of the URL instance. It actually takes things in the opposite direction as I initially understood; it's moving back towards URLs as string primitives which is what I advocate for. I do hope we don't end up adding too much more complexity related to URL handling though.
- echoangle 9mo agoThe class isn’t called URL, it’s called URLPattern. Because it represents a pattern that URLs can be matched against.
- deleted 9mo ago[deleted]
- socketcluster 9mo agoI was aware of the first part though I foolishly assumed by the name that it was designed specifically to work with the existing URL object. I then experienced a bout of Java PTSD. Upon further analysis of the full API, it's not as bad as I initially thought. My initial reaction was kind of surface-level eye-rolling "Oh no, don't tell me they managed to find a way to make URL parsing even more complicated than it needs to be." But in a way, this is almost an attempt at rolling back the previous complexity introduced by the URL instance and acknowledging the utility of the URL as a string primitive. It is additional complexity but I guess at least it might prevent the need for additional future complexity. I hope that's the idea.