Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123841 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 2B4E61A009C for ; Tue, 25 Jun 2024 20:24:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719347127; bh=IBRxa9E4K4nuNyqpZdZJppQ/l426ka7PzXaU2zGQ0hQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=nvf1DfRjX0RN6UphXtD4NsccxyU3RChUfXr5xGdPAsVhg/MM/WX4n6fbvP/nclhOf pWYreOLLD7QvvHASfcFGzCTN2T4Pw2phMHrUCpPu3Zh3F8M/Jsg9G/9nUQHR+ge2Tr NF3px/0vU0TgqdSUbpLzue6cdjVMOhYjnCOAgUtOhQEj7ytsEopTASJlffnCqNTsyM 1zP1qoi+KsPRzUBP7bR1uzZ0lHoBOjfXno7XgO/6nOmnBFex55yC0x7o8w6kHg9KWZ wkgoiVrB9oUy0UePtElS51fMsRV503Bczmi6is7n6/ZEHPDS+W6b1Ii5fac5psF1lI dx5SheX68oU4g== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4F778180038 for ; Tue, 25 Jun 2024 20:25:26 +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,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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 mail-il1-f177.google.com (mail-il1-f177.google.com [209.85.166.177]) (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 ; Tue, 25 Jun 2024 20:25:25 +0000 (UTC) Received: by mail-il1-f177.google.com with SMTP id e9e14a558f8ab-375858224adso21821375ab.0 for ; Tue, 25 Jun 2024 13:24:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719347048; x=1719951848; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=IBRxa9E4K4nuNyqpZdZJppQ/l426ka7PzXaU2zGQ0hQ=; b=UOldIVRUUW9tEPuO5hnQ3m73G5PIS94z7wUQiTjcJt5duo5Fd6YWWkcCfPkMJA4HKw D77bLbFaUTdYIe1Dq41Hh6113SDQcjwTehLQgRiw6elhRjjcRXQ8C+JqqXrkbWHe1h0S Lbol6pa2nzZYr2AZkr8aetQ6NjnVQdkC6GnQlKUX/AfcJLSw6WR4Uy+Yyb7+eewdoYYc eVURiHEfFbo0jt1UrA9Nx/dZOw/FFH7dyQvHrhygGV89cugythuUkebLP0vJe2mr/Rf/ iAdLYx5/a80ZX4wlQJX0SgApB25f2iiSWSTp5W75HE4ZWxq4dz8pCyD+essElTaH1bsw 7VPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719347048; x=1719951848; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IBRxa9E4K4nuNyqpZdZJppQ/l426ka7PzXaU2zGQ0hQ=; b=L3Xe10DoRQ+birxEoHPNupp2csfBvRIf/zf+5YdLwEG0uidem2M++Mu+N1OxDLZAFi nbE2w6yaOR8hNbCDgdF47mm5aI42hwBI8biScKej22LobL2P/RSD0oLqZ7wNSaUZjXAh 5baqy0VqkGzK6XPKSrLf1fguZ1sCdYrT6l0AWFKCXTNx+zJz5v8rEq+quC03Iz/g36CO K++7N/94Jx4hfkIdmUdNL7y2BGsafqNOgIGsYMg8oIaGeoqJ4sJKWYI1VZqSMhDw/sVa RH70YCYPYJnPIiVVnY0z38eL9MAY/ZdE46bxq5NZAb0PNeZTiUaCeJCOpdE1vzMWzC0x fEFw== X-Forwarded-Encrypted: i=1; AJvYcCVQRvAH/6l27MfiRA+Pg7hMQJcpZ3ksoAO7/112Kj+y4glL0B3RgEtK2gsSZP7ENeq/XO/mSdh73Nqc0YI6aihEMVmwJ+GfWA== X-Gm-Message-State: AOJu0YxSJSk0C2SqP3c9TZfXNf+7tBDuKkBNK/tvRz7YKbw2TG02ORf7 YY4by3WBnddgBp5Xl+WQpwkKHRrr2GQLuCWZlLRExrCvJjPWrfVw0wC5JNIp3UIn7vxeMKgfVVx Qu6r2zwcONBQWc9aEMn/1fNuvCZA= X-Google-Smtp-Source: AGHT+IEQA4v4ad/REuWGorq6pizAVscZjZy5rYpTrg1UAFkpfJrqPozX39w5PDxw16/8FslF2nDB7njhhsHJDPtBeDE= X-Received: by 2002:a05:6e02:138f:b0:375:b4a3:9bc4 with SMTP id e9e14a558f8ab-3763f708ca7mr99229155ab.28.1719347047847; Tue, 25 Jun 2024 13:24:07 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: <190506515d4.f695d014203438.1450648485347018411@barneylaurance.uk> <98CEBD66-4E2C-4CB8-8792-A4AEF9982E41@sakiot.com> In-Reply-To: <98CEBD66-4E2C-4CB8-8792-A4AEF9982E41@sakiot.com> Date: Tue, 25 Jun 2024 22:23:56 +0200 Message-ID: Subject: Re: [PHP-DEV] Add bcdivmod() to BCMath To: Saki Takamachi Cc: Barney Laurance , php internals Content-Type: multipart/alternative; boundary="00000000000008652d061bbcaec5" From: benjamin.morel@gmail.com (Benjamin Morel) --00000000000008652d061bbcaec5 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > > I see, I understand. > > But I don't think that's wise. For example, if we reversed the order of > the div and mod, there would be no cache and we wouldn't get the speed > boost. (Or does it cache the quotient as well?) > I don't think the cache is a good idea either, for the reasons you mentioned. I predicted this would probably be on the agenda. Another idea is to pass > arguments by reference, like in `exec()`. > > Personally, I find something like a tuple easier to use. However, without > generics, all we know is that the return type is an array, which may be > inconvenient in terms of IDE completion, etc. > As for tuple vs reference, I think the general direction is to move away from references as much as possible, and AFAIK references actually make things harder for IDEs and static analysis tools, whereas the tuple syntax array{string, string} is well understood at least by PhpStorm, Psalm and PHPStan, which can correctly type the function's return value in their stubs. =E2=80=94 Benjamin --00000000000008652d061bbcaec5 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I see, I understand.

But I don't think that's wise. For example, if we reversed the orde= r of the div and mod, there would be no cache and we wouldn't get the s= peed boost. (Or does it cache the quotient as well?)
<= br>
I don't think the cache is a good idea either, for the re= asons you mentioned.

I predicted this would probably be on the agenda. Another i= dea is to pass arguments by reference, like in `exec()`.

Personally,= I find something like a tuple easier to use. However, without generics, al= l we know is that the return type is an array, which may be inconvenient in= terms of IDE completion, etc.

As for t= uple vs reference, I think the general direction is to move away from refer= ences as much as possible, and AFAIK references actually make things harder= for IDEs and static analysis tools, whereas the tuple syntax array{string,= string} is well understood at least by PhpStorm, Psalm and PHPStan, which = can correctly type the function's return value in their stubs.

=E2=80=94 Benjamin
--00000000000008652d061bbcaec5--