Re: Filesystem path APIs
| From: | Ayesh Karunaratne | Date: | Thu, 07 Dec 2023 07:47:03 +0000 |
| Subject: | Re: Filesystem path APIs | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-121941@lists.php.net to get a copy of this message | ||
>
> There could be OOP-style alternatives too, e.g. Rust has a PathBuf struct with methods that are
> used to build paths.
> However if we were to choose this route then we need to be aware that interoperability with
> existing filesystem functions would be much harder because they all work directly with strings at
> the moment.
>
I think we really could use such an API. I would have liked a more
OOP-style approach, because it can impactfully "consolidate" various
functions into one.
I really like NodeJS Path class (https://nodejs.org/api/path.html),
which I think have done a really nice job at making it simple while
being quite versatile even for remote system paths.
In PHP land, the now-abandoned path-util
(https://packagist.org/packages/webmozart/path-util) library also had
an intuitive API.