Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127454 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 16C881A00BC for ; Sun, 25 May 2025 14:17:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1748182549; bh=kuoYDhLEopqeO1AZvlaap6g5b9M3paL8zdTovodYgaY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=XFU3y0cjwkgtrI3wGd05W2eZDrY69kz1NzvwHarB8HESlUCnNLS4aIpbtr7JnHHfV ZvP8FqldSv6cwAqIBx9eRW0BE97uAM5ic0dJn9AFGoam0MCwzSNAGZvOo5fdNbHVmv Y10TxXHYQGnjV8aLu5xtfAa9ZYE4678jJKeiZ39gEzrmFhS2zlQrBPLXV60qnsJHK5 kIwLmhVXaIXCfNfqsa2u/x11q34szCQq06c4Uvcmz/mzVgoEwWcdXM4a61A9YOaVWU rJQoPMwYbPWIxHnlkchGGIHyZB/nD/tQJWNk8cCcZZHC03hExGZuqJ0dWqbLq9LOTd l4wkrF8WJy/IQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3CEA1180051 for ; Sun, 25 May 2025 14:15:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) 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,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (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 ; Sun, 25 May 2025 14:15:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1748182673; bh=i8DcVzKKkrnj02KPByLg3qc8K5lt7AAu2th5f6NtjqY=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=kqx/C4LyhQwM/3JjVuK78e+vv0p0g4K9mO6pX2MVqQhuIf56o4a1XiA+PGgTv5pBO dNfwyBP37NicXwIBzJRRq6B3pBjumByUUt70XAaemHQOdB6o4X1ojeuokV1f8hkvCU Bx7hpDYV2UZQB5ae3jlCWUMdAdHgb7n7o9XZh20sBw6GOkTL/hzdII1FKdCHVP3Ecd 32yZgrOqkkqsi4esi+hD4WVcTfzwx8ImSjb7WpH6QbHmF4r8fc58rZriI+yh/jQGUY xBDawQfyP0Jdc0UPTqarUpyOqaiSOK4RzQ6y+6r6Y1ujlq509vTQyhViJ6FGwOzOCb fz57AJfneQZJQ== Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Sun, 25 May 2025 16:17:53 +0200 To: Alwin Garside Cc: Daniel Kesselberg , Rob Landers , PHP Internals Subject: Re: [PHP-DEV] [RFC] Add num_available_processors In-Reply-To: <60B4033B-2E6A-4157-A698-6C58454B07C9@garsi.de> References: <60B4033B-2E6A-4157-A698-6C58454B07C9@garsi.de> Message-ID: <4862b0d32cb4f9408f2cea55c6677345@bastelstu.be> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) Hi Am 2025-05-25 12:07, schrieb Alwin Garside: > Finally, from a quick search in php-src there doesn't seem to be any > existing function name that starts with `num_`. For the sake of > consistency with the existing PHP functions, and similar functionality > in other languages, I suggest suffixing the function name with `_count` > instead. > > So, to wrap this all up, I'd like to respectfully propose the following > function name instead: > > cpu_core_count() Naming is a good point indeed and one that I also hinted at with my comment on the PR: https://github.com/php/php-src/pull/11137#issuecomment-2888977523 I very strongly disagree with adding more “randomly named” functions to ext/standard, the times of doing that are over. I would also claim that it violates the “Coding Standards and Naming Policy” (https://github.com/php/policies/blob/main/coding-standards-and-naming.rst) in spirit. At the very least the function should have a clear “prefix”. `sys` as in `sys_getloadavg()` or `sys_get_temp_dir()` would probably work. Alternatively `get` as in `getmyuid()` or `getrusage()` would also work. As I've indicated in the PR, my preference would be creating a new namespace and moving over the matching functions together with a discussion of some namespace structure, including matching exceptions (see https://wiki.php.net/rfc/extension_exceptions). Best regards Tim Düsterhus