Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113903 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 40836 invoked from network); 1 Apr 2021 12:23:33 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 1 Apr 2021 12:23:33 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 559F01804B7 for ; Thu, 1 Apr 2021 05:21:19 -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=-0.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (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 ; Thu, 1 Apr 2021 05:21:18 -0700 (PDT) Received: by mail-ej1-f45.google.com with SMTP id u9so2567096ejj.7 for ; Thu, 01 Apr 2021 05:21:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:user-agent:in-reply-to:references:mime-version :content-transfer-encoding:subject:to:from:message-id; bh=QY0mWnZbZArAudN4ioQxSTPKVpqXLy9oGz9qAuQpdu8=; b=ow5ch0x0F5WianS6aWKsQXjmQkNai5tfqRSZEf4hRIVh5tS+sUTwvL6J4tOfWBiLWF MgHu6iLJGoTDxvzYPQh0mxHPH5aaAOp5MAcMhyCUIuqVrC6czP/q49dfJshE/HGXj1bj YxsffFK64bmGjlptVvLICljX8rNqrdP99xGzMkPMTx7/V41S1s01+8QCJ6RCtXbTQPn7 hJXWhn4NNwyHkGnj5D52vR9midDSXzAuzWz7ab6mrU/BvvX2N7kjIXkkEW/j8sMyTQi6 ZN4GBEyLgB4JMCvSSCyfBsu9OCf+4WGCpGO4eZNGCvNXmSNwn39f/XOHH03nvUU5+wG3 JlDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:user-agent:in-reply-to:references :mime-version:content-transfer-encoding:subject:to:from:message-id; bh=QY0mWnZbZArAudN4ioQxSTPKVpqXLy9oGz9qAuQpdu8=; b=P9ZJEMtgeIOP3oYk2gHUOaWvsw6vqG8Q30lVUKrJ/vmilCwKXDh8IaPus+q5AgQzWK Ll+FdnOGmwI8Dd1kjmKdU5QFNFpH7jdWFWWf5eDLNRFMq/lizfglmb8JWcgVI7pAUA8W M60UlmDPGvzlKhWi7919uoTtobU5345gRGMO72qreK1bmlTDvw7XouU2GHuZx0DhgbYY WDOFJfRBPBr2etU2FU1h5CsPt4h/sKOA1nHKS5MwaFEkSTdi7qvcZzX65SFhG2P3yfmz SraCYHo/7+uN9exbRi9337Twa2U/EKkiBqeMrMELmhmaBriH3QH+mltixj4G0Qg886Ry jyyw== X-Gm-Message-State: AOAM5306Si6Brm/5dMqh8O52Nw/YNL7SJvkvtttmd0p9AvC2+r/oVCh2 nKhPWMo/1CNYB8vYGZRxHQPDs8FpTcQ= X-Google-Smtp-Source: ABdhPJxqZcYWyMJEzbsnxlzPdx7IzNabyi5kLQBC/SUr9lX2QNsLXtQnSjTvRxo+JVtLtHkegVFWfg== X-Received: by 2002:a17:906:f953:: with SMTP id ld19mr8468676ejb.164.1617279677495; Thu, 01 Apr 2021 05:21:17 -0700 (PDT) Received: from [192.168.0.27] (cpc104104-brig22-2-0-cust548.3-3.cable.virginm.net. [82.10.58.37]) by smtp.gmail.com with ESMTPSA id cb17sm3487719edb.10.2021.04.01.05.21.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 01 Apr 2021 05:21:16 -0700 (PDT) Date: Thu, 01 Apr 2021 13:21:14 +0100 User-Agent: K-9 Mail for Android In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable To: internals@lists.php.net,Arnold Daniels Message-ID: <7A382E20-5CB5-4802-BAB0-49AECF32C4F2@gmail.com> Subject: Re: [PHP-DEV] Why is assert limited to a debugging feature only? From: rowan.collins@gmail.com (Rowan Tommins) Hi, On 1 April 2021 09:24:54 BST, Arnold Daniels wrote: >The documentation of `assert` >([https://php=2Enet/assert)](https://www=2Ephp=2Enet/manual/en/function= =2Eassert=2Ephp)) >states that's debugging only=2E This is further enforced by php=2Eini fla= gs >to disable assertions in production=2E This is, in a sense, looking at things the wrong way around: the main feat= ure of the built-in assert() statement is that it can be disabled in produc= tion, and the assertion code will not run at all=2E That feature is useful = if you want to write assertions that run in development but have zero perfo= rmance cost in production=2E If you leave them switched on permanently, the advantage of using the buil= t-in assert() over writing your own becomes very small - the definition wou= ld be two simple lines of code=2E There's nothing to stop you doing that, t= hough; the documentation is just giving advice=2E The two libraries you linked to concentrate on a very different feature: c= oncisely writing certain common conditions, such as type and range checks= =2E It might seem reasonable to include common features like this in the la= nguage, but the fact that you linked two different libraries demonstrates w= hy that might not be a good idea: the API and feature set are hard to get r= ight=2E Once a feature is added to the language it is very difficult to cha= nge=2E Regards, --=20 Rowan Tommins [IMSoP]