Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127267 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 lists.php.net (Postfix) with ESMTPS id F169E1A00BC for ; Thu, 1 May 2025 17:51:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1746121738; bh=7ieaKD8rlOTrkIx6BqHUO7usEgoiWkCOL7j4X+Bg0Dg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=hdf8/RltaTnUHm8SAF1LKEDUsjukWeN54OKDr/wqzB9itOn3Ssm2We5aRoyzXQStu n1dIsgJ/gjBw4/6GO/lGnIHTKW76CcCmNtlRbvOTU3LxyB6/DGwsLlTfQiiERDXxOz svK86iQBEeDTadf3CN2/TiXMQdnGior5GizdtykjHO4bRlcedDYVuUqnn0YkAnQZSQ ulZIZ7VgVDs/tpjX3JiTXIhiZvh3wvFTNPo4zqTia3qhHFpj0Rhv1UY6I087BE2fty q5b85l0bW57kgs9Env0v8iZodaXihxmPhOOaPMy+DV1YPtpk6lulutDYXue6LVQkyt 3mCcVfadzkj4g== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 67157180041 for ; Thu, 1 May 2025 17:48:56 +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, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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-yw1-f173.google.com (mail-yw1-f173.google.com [209.85.128.173]) (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 ; Thu, 1 May 2025 17:48:56 +0000 (UTC) Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-70842dc27easo12367547b3.1 for ; Thu, 01 May 2025 10:51:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746121871; x=1746726671; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=C3PGyr9PoePzZDlA3rUnbTE/EgIpIwDOb2mKe4vzx58=; b=KnI0SynFpFJDL5h8vtGU4CzI877IPPst8NenmGjrTXoIpVP8QM82vXtfsYKPn54epx sJUYksF4sBQJMXn6aKARf1dUxH/8OzAlq8rDDu/UDlnGrAijj2ffMlWMIlRUF01MRCSp yk2S8O35U8zWZHaLl7Afdb/EhVf4oc/fJrIVGtRDxWxliXP1fDtJxgpMx1Y0DtzhO2xi kkzGGXSr8c1ksBwkNz0b6P4wTqupP/ypUkLBJ0cE9hT00qXuAar4r2Ty1SAmrE1qdDau q5NBcbyDG8A+UijVNFRow7wpH+NBflK8S0GZO3MuH4cCKs2oGx1J8v8SgjmT53AfbPni jF0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746121871; x=1746726671; h=content-transfer-encoding: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=C3PGyr9PoePzZDlA3rUnbTE/EgIpIwDOb2mKe4vzx58=; b=dt1ykuMjhr3st1tr5C2Du5joap6+KZ0bGCceT+Uxy/Aw/CknYgVUZ2VjuEutoMRnWX qktIkQjRPueh3mVsZoCp1r9hOBfpcogdccEwXn8vwIDSpK9KLgBaMHwJ/QjbW2EmiB84 7PES1DmHcrRrjCGt+9ApDn0Iy3rFysv3k/OnXWUeS8daGYVtBGA7jrgP07qlZ0EIJ+PN fFSApcNjbzTdDonF33l8miSq56Tfn0FMUDVsvrQbExXKueaoD66mX2tnKGDALY4kruO0 XyE8FGlAnnCyO1stnfbcQsxLy4WxvKc4zbfSJaGz4bkKuAk9SlW9bky74H4GZt+pPd01 kpcw== X-Gm-Message-State: AOJu0YyRKth8pRrOIIzz3OHMdJ+AwLWEs+A/maKG3WNMH6rbeoccgMAv Se5nwVqCd/uy7Z5vOPqC4YGF1ZIbH4h64wzTpNQ+0IQaaVw20lY9yRRfwmT4sq2zGzrhSYjVhYD hT3Ctv6Tbx0fbM4zfo3fB6VPrEikZ/pCrbCE= X-Gm-Gg: ASbGncsIdWAMo8kRhLcsSHD/c0uxbE2/Ddh49EY9g8K8ohJGUTHbJzsMn9IM5KzR7+U MhdxOJ4ciyHdKJLupzD4HtrQgRHQW5ZGYNOCEYVAfz5Odqw4yCvTdppQRj3t7jUSfUXEMMC60jq aZ4LH5s3DNfna1k1FpPLvw8Q== X-Google-Smtp-Source: AGHT+IFnh/07zf+BWlpgKmUyh8GgefJXSV86xsgPLdNjTkru4yXb518iZXpkuoIOYI5WdCNvJjHmceMrDSl/X/mzj5M= X-Received: by 2002:a05:690c:6505:b0:708:c7db:ceac with SMTP id 00721157ae682-708cede91d4mr2568887b3.24.1746121871475; Thu, 01 May 2025 10:51:11 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <39597a9c-6854-40c6-a529-32b2b178cb27@app.fastmail.com> <150fb4df-47a4-4ab3-8edb-13e446b122cc@app.fastmail.com> <8ba39427-bc2d-4c2a-90d8-648371e4f576@app.fastmail.com> In-Reply-To: <8ba39427-bc2d-4c2a-90d8-648371e4f576@app.fastmail.com> Date: Thu, 1 May 2025 20:51:01 +0300 X-Gm-Features: ATxdqUFRv0oa8J0HQnZx3sdkX6rJsKrGlRxduvB3GG4nsEWA1Cz7FRG1XrWyAyo Message-ID: Subject: Re: [PHP-DEV] Concept: Lightweight error channels To: Larry Garfield Cc: php internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: edmond.ht@gmail.com (Edmond Dantes) Hello. > Suppressing? You mean fataling. Suppressing implies ignore, which is th= e exact opposite of what I am proposing. Yes, it seems I didn=E2=80=99t explain my thought clearly. We have the following code: ```php function some(): bool { return false; } function target(): void { if(some() =3D=3D=3D false) { // error occurred, some logic if error } } ``` The point of this code is that we handle the error immediately at the first level. If we rewrite this using exceptions, it means we=E2=80=99ll be handling the exception at the first level from where it was thrown. > success return + error-return + the-world-is-broken By "the-world-is-broken," does that mean "throw"? And why is throw better than return? Why? > Exceptions that are sometimes checked and sometimes not is Java, which is= exactly why everyone hates Java's exception system. That phrase can=E2=80=99t be considered an argument, because it=E2=80=99s u= nclear who =E2=80=9Ceveryone=E2=80=9D is (I=E2=80=99m not part of that group), why the= y hate something, and why we should care about their negative emotions. Maybe they=E2=80=99re wrong? Exceptions are a technique with both advantages and disadvantages. For business-oriented languages, the advantages outweigh the drawbacks, because there's less code. Less code means fewer bugs. Less code also means lower coupling, which makes refactoring cheaper. Cheaper refactoring makes business development easier. In programming, it=E2=80=99s often the case that something becomes trendy, = and old tools start getting hate just because some new-but-actually-old approaches have appeared. But in practice, trends fade, the fog clears, and proven methods keep working. :) > It's clear you do not support what I am proposing. Why can=E2=80=99t I partially agree and partially disagree? The world isn= =E2=80=99t black and white. I agree with the questions you raised =E2=80=94 each of them is valid on it= s own. But I think it=E2=80=99s worth reflecting on the implementation. And Occam= =E2=80=99s razor should be applied here. Best Regards, Ed.