Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121941 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 38179 invoked from network); 7 Dec 2023 07:47:33 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 Dec 2023 07:47:33 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D2E55180003 for ; Wed, 6 Dec 2023 23:47:44 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from forward501a.mail.yandex.net (forward501a.mail.yandex.net [178.154.239.81]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 6 Dec 2023 23:47:44 -0800 (PST) Received: from mail-nwsmtp-smtp-production-main-54.vla.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-54.vla.yp-c.yandex.net [IPv6:2a02:6b8:c18:3d80:0:640:1395:0]) by forward501a.mail.yandex.net (Yandex) with ESMTP id B054A61929 for ; Thu, 7 Dec 2023 10:47:28 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-54.vla.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id RlX5ns7xHa60-qd7Deyud; Thu, 07 Dec 2023 10:47:28 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=php.watch; s=mail; t=1701935248; bh=UModDg713AQXn0Lww9OazV6s2aUaLVOtuAizx9zGUDc=; h=To:Subject:Message-ID:References:Date:From:In-Reply-To:Cc; b=OQ813lGxKtJ5BKXZTxxf3NQCi8OAL+bUwKijmmmarV3bZSYJtmm3uqDhSUhpoWrjI cLIlDZ49aJjBE3eWvbKIsYidk5T4Npr/gazAXsq3iIVg3Mh4Qz74fZI/3cgs9VpTlB 1xycbYHVIwMUZAISJt/CH5lq6ogZ7V4Zk6MyHDs8= Authentication-Results: mail-nwsmtp-smtp-production-main-54.vla.yp-c.yandex.net; dkim=pass header.i=@php.watch Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-50c02628291so358333e87.0 for ; Wed, 06 Dec 2023 23:47:28 -0800 (PST) X-Gm-Message-State: AOJu0YyX07q3+eyWQ2WxSeu/zB0CsETq/lFRuFIJR9hZ6FPB2qo4asfC fWCuwvs6Y6GvNuQAT/izBmHx5fOLQ6xJO0b1MRY= X-Google-Smtp-Source: AGHT+IGhe/rb/0Gc8GfBPz6g7SDSsZvBayJq+HZcIs98a3gNf615/+EB8phNfvq57KLkdyH87phl/5KHBtZgmGvJ1kQ= X-Received: by 2002:ac2:59c4:0:b0:50b:e4a7:948 with SMTP id x4-20020ac259c4000000b0050be4a70948mr1122490lfn.126.1701935247810; Wed, 06 Dec 2023 23:47:27 -0800 (PST) MIME-Version: 1.0 References: <8f4e3274-6489-4378-82db-fb4829770196@gmail.com> In-Reply-To: <8f4e3274-6489-4378-82db-fb4829770196@gmail.com> Date: Thu, 7 Dec 2023 14:47:03 +0700 X-Gmail-Original-Message-ID: Message-ID: To: Niels Dossche Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Filesystem path APIs From: ayesh@php.watch (Ayesh Karunaratne) > > 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.