Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114152 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 22513 invoked from network); 25 Apr 2021 16:30:19 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 Apr 2021 16:30:19 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0E2AA1804BD for ; Sun, 25 Apr 2021 09:34:08 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-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,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 25 Apr 2021 09:34:07 -0700 (PDT) Received: by mail-lf1-f47.google.com with SMTP id n138so84790974lfa.3 for ; Sun, 25 Apr 2021 09:34:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=vcMRf1BXlQKW1+XbsMuDtbf0wxEun3XVSZm01wEyQ70=; b=kMHCXEqlIJ8BzOHS+JfbIA1mYc4LwbofeWTH6gLEoWc9iRGF9qEsbInjSfrg6QW0pZ b6z3xBcVo8MeEwrY7WXZX9nIpYE1fEl+44kDQrm9+pvTYTUBhlfH9ICr24l7ztiLTRqB j7CGBHmFQTP0ZpZ6pJNbPg+OdTwYACE+GjlrOkMhc1hUagB0HF9VVU9lKQUGKDWKH220 jT1m3kEMpE5Wq7tPCbuUACYw+g4qTXybrVm+qWj09cDymY2Emiqhnq5AkQ2XuRUW2Y7k YQdLM3xcu9EC+UUkoLBdeJT22jXi0V52/N85aa9DVh5FTn06KvXMzdoNESQ3F30PvU1e ULUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=vcMRf1BXlQKW1+XbsMuDtbf0wxEun3XVSZm01wEyQ70=; b=CcrE8e/YCkbu9knJlrF85VNyqelCrUXDU4MGjJ3YWKiCRPAJx35j0AkpzDDj4yg2IT 726gBS0RPLSvnnqgkiUp7NBaqVaoEOoggeGwWiUI5AY/74Uw84+HRZpAPADBZgEJP97e 2hF0u18bqYaf/kDS3ClmfcT26YaMtLSL3XqshoDDptrNrLRmtA/Iwiy0dqzp+pd/kNPq GxXaZjMy7BzGuMlswe+rHXFpmL8e1QcvlQP9nchN2NQCLzUNoAg6w4mxntJAPkDWmsfB F+rO7Oj84oP2nr9UOwfntStVHEjPKPj1EtFctHaTsY/YprJqcF7ke5IOy6peCSX7e8/K nVfA== X-Gm-Message-State: AOAM533gAshbOnvCOTbX69N1sU4lhbpLnMO4ymJ3YlZ+JDwEO1LhQ6la kblJxQTfd1fjqdBsi8pjjGFBV+OOqQ8AJHrNVRZmS+p9 X-Google-Smtp-Source: ABdhPJwqbyaIIOECUakbRVcRaSaW4rSgqmPeDvwEtb/KIzSVxJT3fb0Ffivcxk5xDwWTGqtMKmwzZBvvw0iKKr63OuM= X-Received: by 2002:a19:f018:: with SMTP id p24mr9500505lfc.421.1619368445968; Sun, 25 Apr 2021 09:34:05 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab3:4e13:0:0:0:0:0 with HTTP; Sun, 25 Apr 2021 09:34:05 -0700 (PDT) In-Reply-To: <255e809d-a70e-4524-8aab-8e7ebac7971a@www.fastmail.com> References: <5b9f1500-615a-48f1-815f-1d48b327ef90@processus.org> <179049b1475.11134368b213512.254739612773841999@void.tn> <255e809d-a70e-4524-8aab-8e7ebac7971a@www.fastmail.com> Date: Sun, 25 Apr 2021 18:34:05 +0200 Message-ID: To: Larry Garfield Cc: php internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC][Draft] Sealed Classes From: olleharstedt@gmail.com (=?UTF-8?Q?Olle_H=C3=A4rstedt?=) 2021-04-25 18:27 GMT+02:00, Larry Garfield : > On Sun, Apr 25, 2021, at 2:04 AM, Olle H=C3=A4rstedt wrote: >> > A total function is a function that is defined over the entire domain = of >> > its >> > inputs. For example, addition is a total function over integers, >> > because >> > for every possible pair of integers you pass to it there is a logical >> > return >> > value. However, square root is not a total function over integers >> > because >> > there are some integers you pass it for which there is not >> > representable >> > return value. (Negative numbers, unless you get into imaginary number= s >> > which PHP doesn't support.) In those cases, you have to throw an >> > exception >> > or return an error code or similar. >> >> Maybe nitpicking, but PHP-land shouldn't make up their own >> definitions: "A total function is a function that is defined for all >> possible values of its input. That is, it terminates and returns a >> value." >> https://softwareengineering.stackexchange.com/questions/334874/in-the-co= ntext-of-functional-programming-what-are-total-functions-and-partia >> >> Which means a total function is guaranteed to not have any errors, >> like exceptions or division by zero. Compare with languages F* or Koka >> which support this notation. > > That... is literally what I said. There was no making up definitions. I > was using the actual mathematical definition. PHP is quite capable of > having total functions, they're a good thing, and we should try to encour= age > them where feasible. What's the point of encouraging total functions if you can't express the totality in the type system? Olle