Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124236 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 qa.php.net (Postfix) with ESMTPS id 9337F1A009C for ; Fri, 5 Jul 2024 20:39:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1720212042; bh=JsOCHwskesdFCOINQzSz/749oMmUV/KKAaENwpI2LU4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=DcqnoTRcqe9zA0gjjPEzv5dt+u2FjZNLo8ciEhzTTgTVX8t4fEI5GEf8aLs6L8m1h i6mnWJMMnlhj+B8ZWcxNNKM6PfgosZM0/eBZ/bo7YuOGacKQ6DRkUVMtC2eMk59zYV zFU84GueHUxDy0ELvaXkGiGsoxsCtQ0RbLRaZDV3332cnw1C42admIO26+KafylyEk g82hgrNBSyaErumb60vmcDi0+pmbkbQFGfVYPTx+mUT2CJrC9ujHBf+kyFYKI/vlpj amHWixl0D+okM0lmsxx+ShGcM+eu0EWVOyGDx8/wGVf0/i0J/rbBykfn0kQNphCCwB WewWs0Pn4xN6g== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id CE0D1180637 for ; Fri, 5 Jul 2024 20:40:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 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 ; Fri, 5 Jul 2024 20:40:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1720211956; bh=JqaquIJ/zgGe9RWM14TMqlPid9vGn52Ux9f2wXx5vKE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type:from:to:cc:subject:message-id; b=SVGECMsInk1U52lDfdVotOAow7ssASmGFdKv88M0VMYSrG1fm2tf+/kSshGIkIksM AC/FSCEQcK937NYsSkRbQHg3jD1+oghQe5dBYBsjQuscE0Oym3v3t7Ht31o0C9rN5+ 5d1cONjYhEAzoc9qNHCsFhWmHKq9YBH0cIplmqw1i18AfDPcz/EyjDYpfQcPL72K+B jBRfnFMKKrAfNSSJAFiaBYuVmM4Llzr1ZSwkymOd6Nn1qOKbbFXR59zrJ/HgSaUv0f aP05D4AyxLvK7vJK7B0YMZzH0+J1L/kFSO4nB8kxQ9q/q9430LsakpEtS7Zb6pclYz SYrjC3Go9Zwsg== Message-ID: Date: Fri, 5 Jul 2024 22:39:15 +0200 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Subject: Re: [PHP-DEV] [RFC] [Discussion] Add bcdivmod to BCMath To: Rob Landers , Saki Takamachi Cc: internals@lists.php.net References: <668168A7.4040005@adviesenzo.nl> <3B23E039-D90F-4F84-9ECE-C6A9A3E145AF@sakiot.com> <870bb837-400c-4a86-ab49-2ffef9d80ce7@app.fastmail.com> <0902ba2c-6247-4908-9264-c4fe533901f4@app.fastmail.com> Content-Language: en-US In-Reply-To: <0902ba2c-6247-4908-9264-c4fe533901f4@app.fastmail.com> 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 On 6/30/24 18:08, Rob Landers wrote: > We can argue the semantics of input/output, but the point still stands that return by reference is still more common than structured array, and even then, those are usually much bigger things. > Happy to argue with you. I explained for each of the examples you mentioned how it differs from the use-case solved by `bcdivmod()`. To give some examples of functions that return a structured array and that I believe to be reasonably similar (meaning: they destruct/parse the input value instead of just providing some metadata like opcache_get_status()): - pathinfo() - date_parse() - getimagesize() - openssl_x509_parse() - password_get_info() And for functions that return system information: - opcache_get_status() - sys_getloadavg() - stat() Please explain how their output arrays being “much bigger” makes a difference to how the API is perceived by the user that wants to use it. Functions I see where the result is returned by out parameters only, without having a regular primary return value are (this also includes some closely related functions in openssl and socket that I do not list explicitly): - getmxrr() - openssl_csr_export() - socket_getpeername() And for all of those it would arguably a better API to just return the value and throw an Exception on failure. Best regards Tim Düsterhus