Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122303 Return-Path: <6562680@gmail.com> Delivered-To: mailing list internals@lists.php.net Received: (qmail 87252 invoked from network); 6 Feb 2024 16:09:13 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 6 Feb 2024 16:09:13 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1707235805; bh=mq5x7d/YO/lbOEHWetTC8mBpzY2ofknjiBRTGN2J8wA=; h=References:In-Reply-To:From:Date:Subject:To:From; b=ZG1JXdm670LDZuPnh4/VfCG4EykZrR+A48SyG1HRJ0+dYZCdyWev6XSFNPq8EWrPl 2oiqE3n/ksGOJT/7Rf4yivAcNRwVkfeDj+My8Yn520aQwEwDMQh7/dTpabVbjA3fIC 5mNwYu18dx41K0pu2laLYr5b2FOlCin7E0dujnJqubIanx/voS8A1cWDsGvpZAcRKt iHohVG5DFMjqH/E88yQ3kPN5ug6r97Ky17r9caGBc1s2wHYx7e+5yY2gxuIIoqHafw 8kksUJ1yvSxHY/lUiCcmxBJP0LkfuCkIsFT8Ax2f9MFUNyXyvYwgn7bSih39i2JTlU sL2ge8OIsahOw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 194D4180039 for ; Tue, 6 Feb 2024 08:10:04 -0800 (PST) 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.4 required=5.0 tests=BAYES_00,BODY_8BITS, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: <6562680@gmail.com> Received: from mail-oo1-f48.google.com (mail-oo1-f48.google.com [209.85.161.48]) (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, 6 Feb 2024 08:10:03 -0800 (PST) Received: by mail-oo1-f48.google.com with SMTP id 006d021491bc7-58e256505f7so3169846eaf.3 for ; Tue, 06 Feb 2024 08:09:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707235751; x=1707840551; darn=lists.php.net; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=UgPHi1O/lY7x5KZr2sAN7ivioicXIWt8KfzoZeHDJUw=; b=G42sxDXGQRcwOwQeeQNRy5Byjn7GwC5uNzIMMDcKDCZRERBcz8u2DlNd4iVmvLdkSN tS9s9fH/40H+afxtb80spuK6mZUNc2QPcNa6i5kHPHfR6hbjrNF86dP4Pwz2vtcT6DXe D22HgIixWcAhKdzL8lJBSkmoB8/oNtgvEheM66265oyfSuTsbZqzL744LM12tFbfRawn p0nb9yqj0NC/nOOEIlcZ5yVhVLAlvA8OaW4uIZmnjbVdTdai/DFM50genMr4NA8iSTK/ Db56wR2GPMNXLFGb9YazNfdiUuh7C55k+3xCugP1qY0Yl5G3SDLybDd/g92RMx3A2ucy +K1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707235751; x=1707840551; h=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=UgPHi1O/lY7x5KZr2sAN7ivioicXIWt8KfzoZeHDJUw=; b=F/Hs9i03d+Ege2Clm4U4BeHp5Xp8NhrdGTYi4mmt/XySgEWIcGwLVzyU0Kav8R2t0z pVaC6RWsXEdkEW3WIaHfGsLt05EwEUoy9ze06eVicKsHaoPYkIQpLgu6I5RNd48vUoCV gSB3uKANR8s5T2E3Th+isoPA8rqyldBzO3IGpHSe/cCf4fu6ng6a+TitNKQDlztnEE7G DVHnsSJR/aE1OUUYv5+dSC95goFbCjiU53O5zJ6sSTs0mPUPzVd1LIuwuaNXe2CKRbms TRbUU9Gfwly/BnMavGl6qSH2SknpGgUhbQbFeIzFS7gNA2LirdiJ4X2AMTzyCAUFp0MP NL3g== X-Gm-Message-State: AOJu0YywodjLSGAdMwA9JDeahSipBCSAE1kHyUFB1/Yj0p3rlk4MCiek 1yC0Q6nlNOfzmxKyOmajtyV9QWK1Urq4inlXryJbr9n9jzkB6RR3KrAbuM70ZjApQxpt4H9a+tl 2z9mzGCx2pAWCucqWzVnOx1Ucd4Y= X-Google-Smtp-Source: AGHT+IGkC4c5DhpUO6dE4tUIOOsvgRVlLj3vELzQICzuT/gCIiBai/ToWOOAxYJ3i8WSYXjaCxEE+lrRDWtwgPMoXtA= X-Received: by 2002:a4a:ded4:0:b0:59c:f58e:7805 with SMTP id w20-20020a4aded4000000b0059cf58e7805mr183683oou.4.1707235750733; Tue, 06 Feb 2024 08:09:10 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: =?UTF-8?B?Yg==?= <6562680@gmail.com> Date: Tue, 6 Feb 2024 19:08:34 +0300 Message-ID: To: Arvids Godjuks , internals@lists.php.net Content-Type: multipart/alternative; boundary="0000000000007869780610b8cca3" Subject: Re: [PHP-DEV] Feature request: https://github.com/php/php-src/issues/13301 From: 6562680@gmail.com (=?UTF-8?B?0JPRgNC40LPQvtGA0LjQuSBTZW5pb3IgUEhQIC8g0KDQsNC30YDQsNCx0L7RgtGH0LjQuiBXZQ==?==?UTF-8?B?Yg==?=) --0000000000007869780610b8cca3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable My function seems like this: ``` _error_bag_error(error) { if (stack.errorBag) { stack.errorBag.add(error); } } ``` It does nothing if i didn't initialize the error bag manually. I should call _error_bag() inside the current function to create one in the stack, or _error_bag_push() (and then _error_bag_pop()) outside the function to collect children. Doctrine's main problem is the dreadnought that throws low level exceptions and forces developers to spend weeks to understand "wow, that's the way it should be". Funny but painful. For one small benefit - reducing the count of queries by unique insertions/deletions, maybe 10% of queries are removed= . =D0=B2=D1=82, 6 =D1=84=D0=B5=D0=B2=D1=80. 2024=E2=80=AF=D0=B3. =D0=B2 18:54= , Arvids Godjuks : > JavaScript is JavaScript - it's not a good role model to look at. If > anything, JavaScript is a collection of things of how not to design a > language :) > > What you are looking for is Golang. > > The level of changes you are proposing require it to go thriugh an RFC > process, have 2/3rds of voters to agree to it. Tland that is after a > feasibility study is even done - engine might not even allow to implement > such thi g and require exte sive modifications for a thing that should be > done on application level to begin with. > > And memory usage is one of the biggest points against it - engine allowin= g > to store I side it arbitrary data that is logged by application on a > per-request level is just a bad idea. People will shove megabytes of logs > into it in a loop and them file reports "why is php using 2 GB of RAM?" - > this is literally a daily question you get woth relation to Doctrine when > people try to run bulk operations, do not disable trace logger and them r= un > into the memory limit. > > > What you are proposing is a footgun at it's finest and PHP has a rich > history of those and we have learned from the experience as a community. > Things like this are left to the userland. There are many libraries that > help handle this. > > On Tue, Feb 6, 2024, 17:35 =D0=93=D1=80=D0=B8=D0=B3=D0=BE=D1=80=D0=B8=D0= =B9 Senior PHP / =D0=A0=D0=B0=D0=B7=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=87=D0= =B8=D0=BA Web < > 6562680@gmail.com> wrote: > >> Javascript is closer to. >> >> It allows you to throw anything, but it is still the throw statement, >> keeping in the mind the async nature of js - memory and processor stuff = is >> shared by the time. >> >> JS seniors usually hate those guys who throw anything except language >> Error >> class because they skipped the mandatory level of programming - OOP. The= y >> are now taking fun from it. We're tired of OOP for now. Once you work wi= th >> batches/queue/bulks you need pipelines and chaining, and there's a throw >> works only to stop any certain tasks and almost immediately catch the ne= xt >> line. So `throw` is required to be safe-shield, but solves not enough >> count >> of cases. >> >> Old, maybe 10 years ago, Fowler's article about "errors is not an >> exception". He explained why, but recommend to implement own error bag. = I >> tried few times implement own error bag on production ready code. And th= is >> is the hell of rewriting full nesting tree and carrying that return >> statement to upper level again and again, then you start to get confused= , >> then you rewrite all return to objects with properties/getters/setters, >> then you understand your PHPStorm started to lag because of 70 uses in >> class... Better to use global error bag stack that you can enable or >> disable for your needs outside function ("in controller", GRASP) or insi= de >> function directly like old good times $errors[] and if ($errors) { retur= n >> null; } >> >> >> =D0=B2=D1=82, 6 =D1=84=D0=B5=D0=B2=D1=80. 2024=E2=80=AF=D0=B3. =D0=B2 18= :23, Alex Wells : >> >> > On Tue, Feb 6, 2024 at 3:58=E2=80=AFPM =D0=93=D1=80=D0=B8=D0=B3=D0=BE= =D1=80=D0=B8=D0=B9 Senior PHP / =D0=A0=D0=B0=D0=B7=D1=80=D0=B0=D0=B1=D0=BE= =D1=82=D1=87=D0=B8=D0=BA Web < >> > 6562680@gmail.com> wrote: >> > >> >> - add non-breakable interface and language construct `raise` to "thro= w" >> >> error without collecting trace >> >> - that error could be any scalar or object, or you can implement new >> >> interface for them, keeping that is nested and taggable array >> >> - this `raise` could be catched same way as \Throwable allowing log i= t >> >> anywhere you need or re-`raise` again >> >> - `raise` statement won't start to collapse/break code, so it could b= e >> >> skipped without affecting application >> >> >> > >> > Is there an existing language that does that, having both exceptions a= nd >> > these silent raise statements? >> > >> >> >> -- >> +375 (29) 676-48-68 <+375296764868> / Mobile - =D0=BF=D1=80=D0=B5=D0=B4= =D0=BF=D0=BE=D1=87=D0=B8=D1=82=D0=B0=D0=B5=D0=BC=D1=8B=D0=B9 =D1=81=D0=BF= =D0=BE=D1=81=D0=BE=D0=B1 =D1=81=D0=B2=D1=8F=D0=B7=D0=B8 >> https://t.me/gzhegow / https://t.me/%2B375296764868 / Telegram >> 6562680@gmail.com >> > --=20 +375 (29) 676-48-68 <+375296764868> / Mobile - =D0=BF=D1=80=D0=B5=D0=B4=D0= =BF=D0=BE=D1=87=D0=B8=D1=82=D0=B0=D0=B5=D0=BC=D1=8B=D0=B9 =D1=81=D0=BF=D0= =BE=D1=81=D0=BE=D0=B1 =D1=81=D0=B2=D1=8F=D0=B7=D0=B8 https://t.me/gzhegow / https://t.me/%2B375296764868 / Telegram 6562680@gmail.com --0000000000007869780610b8cca3--