Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114144 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 80463 invoked from network); 25 Apr 2021 07:16:05 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 Apr 2021 07:16:05 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 49D431804CC for ; Sun, 25 Apr 2021 00:19:49 -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-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (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 00:19:48 -0700 (PDT) Received: by mail-lj1-f181.google.com with SMTP id o16so60346758ljp.3 for ; Sun, 25 Apr 2021 00:19:48 -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; bh=kAg0kbQq+qoCGwggWtRPEsX2Kcmi+jVF3pqv5Hefun4=; b=lMXxoDEKUW2z31s/5GaAIkgot/Evo3ecvKL+mIrMOxLq6I2BuyIQXX8e4bA48ND8Kz q32owsIqUjUIVS/5N3FVXYRDWwh9pHeApGC2Zyt1PU5tNrliio9eOpTFj9zyDIhj25zK L+OKt3t1bTqaG++gWzb+2LhIwyeJNTmDGLDmJ1R4XVcXRn0EorrUQ+rHMyTVBjoQan0o 0GSa7DRJ16Cx5M+I3xj0FOAfKZVM+DTzOYhWIQYmUm2u6J4JFOYhs0tcssWHIwXFmt/Y UmzxlZVLBhEb3VtFwkI5+YClOo1gJYtI6zGRUdkO2tci/Jw/yNGFnKurv0QiUWpmxYnh Cayw== 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; bh=kAg0kbQq+qoCGwggWtRPEsX2Kcmi+jVF3pqv5Hefun4=; b=QKYZ7x6SoO7iptQJvnSmWEa3fq9z1HBoHcgflDPyzDBC9hGLinzjHE+SYnD9ZK+F98 jTqtAUoYZWfFbVKf4x6KKNFhVYNwn6YeWk1uyC6qM0L1D3fzqSSCH5kyHL1lqhRQnO3d rWQ3lHe/Dk5H/9We3VgIFAMc/sUBp6YU1GqZSQRXWE6hmfEGT/4yByf6wHdF9grvrR02 FJVqZvIap1Hg5NdjeB33lZZDaW++X8Y8UYwKn85oBSaWsBm2ymH1y+XX0hbP77CMCi2S CZlkWri3ZgvlyyoCiLAQTX7vZ73LM3IS6NaK3OOfgipXk9TZTPbfDAWZtBbP7bmMxHqE LzQw== X-Gm-Message-State: AOAM532FlmX98jhMIN58hdI7tgtOWn5ZYaEKNlO76CbjKiZ4+djvIwZk fTwUd70mx9lM4BEbAJcLKyw7r5ZFb/TVtP/LrFk= X-Google-Smtp-Source: ABdhPJwaKl2aKwBuyUohm8hScneO/DMdeP0bdqJ+y2hbKawbPJdNXlwfsg/I4To1Qs9+OOHDjcpzzXAkk8CqO55J8Mo= X-Received: by 2002:a2e:b0cd:: with SMTP id g13mr8613096ljl.71.1619335185042; Sun, 25 Apr 2021 00:19:45 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab3:4e13:0:0:0:0:0 with HTTP; Sun, 25 Apr 2021 00:19:43 -0700 (PDT) In-Reply-To: References: <5b9f1500-615a-48f1-815f-1d48b327ef90@processus.org> <179049b1475.11134368b213512.254739612773841999@void.tn> Date: Sun, 25 Apr 2021 09:19:43 +0200 Message-ID: To: Larry Garfield Cc: php internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC][Draft] Sealed Classes From: olleharstedt@gmail.com (=?UTF-8?Q?Olle_H=C3=A4rstedt?=) > For a more typical PHP example, getUser(int $id) is not a total function, > unless you have PHP_MAX_INT user objects defined in your database. If you > pass an int that does not correspond to a defined user, you now have to deal > with "user not found" error handling. getUser() is not a total function. > getUsers(array $criteria), however, arguably is, because it's logical and > reasonable to map all not-found cases to an empty array/collection, which > doesn't require any special error handling. getUser() could return a nullable type. But totality assumes purity, and I'm assuming you didn't hard-code all users inside the getUser() function. :) As soon as you interact with the outside world, you can have exception and errors, and thus you can't guarantee termination. In any case, I think the concept of totality is pretty foreign to PHP, and we can probably leave it behind (you'd have to make sure - statically, in the type-system - there are no infinite recursion, no infinite loops, ...). Olle