Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122304 Return-Path: <6562680@gmail.com> Delivered-To: mailing list internals@lists.php.net Received: (qmail 88767 invoked from network); 6 Feb 2024 16:13:57 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 6 Feb 2024 16:13:57 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1707236089; bh=VJRHj2/u/2iGQMn5jtUTA8mkM+5aPNWev0df0jcfDQw=; h=References:In-Reply-To:From:Date:Subject:To:From; b=OPIiqKdu8nkQ7mGs1TnFTIDOmb1/7LIlVn9RdZwb76fu1p+vwTlgnzzY87EEdEvec Oyonchw/y8wYhXDMXFQY31AZ7Ahp799XprosMEGUBeLt/Ko3L55ulhWBK1wcPaPAPi WzTNsP99UqoyiKR+sCQxURxzuPC+G0Rxqm9+0bPn2AJz1s/89FEevenE3vOvnmR+3S DRmsdcAgTnnLx80/DTJUnmwOU6hUgyCPJw7hlfmSQOFzBliGwVISfXEdHy2nJ01XGQ tLflg9C3h5daBv+2z3zP0wGRZjIQlScD5YnWm22xCfFKwZWd99Lo+MtzCTnq4vVeqQ Le5egd5JPYo3A== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4A06E180042 for ; Tue, 6 Feb 2024 08:14:49 -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-oa1-f49.google.com (mail-oa1-f49.google.com [209.85.160.49]) (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:14:48 -0800 (PST) Received: by mail-oa1-f49.google.com with SMTP id 586e51a60fabf-2193ccbb885so498938fac.2 for ; Tue, 06 Feb 2024 08:13:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707236036; x=1707840836; 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=JagQAZvcqxjZszZ/1Tj8B46TdEWD2m6uExPaJUOEhhg=; b=KLcR3iSrfwrSZom2a+zMiLl4ADT9mHmxSiOy9YbF7U2ulKgwg6x/kMmbaAtCirGI3v 34RfWz5aiJld3fulB8f8KJUw+dZlIY/Yo1JzahT9hVk3bUNFAIR5ZPowd7dVaYcd8SUo WAnyd1RFfTup5RzDQadzbKftQQIry8F+EcbmrTFJSBXnUHdLgwl4KHuco2+CawPY83Nc vA9++rONixn7O8yhgX5NrFXGb00NsrqFhitpkh9h/J3hArY8Ujm4Xw8HkCmvbfbr5eqe Kk8qhHovOmtEx6CGHfkmFl2EcJUtc5exhy8+TBeQZOjxCScCa2BZrJlax0OGGsrezqJv Izjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707236036; x=1707840836; 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=JagQAZvcqxjZszZ/1Tj8B46TdEWD2m6uExPaJUOEhhg=; b=arJmvBBUX42BBVIVuK/KxZTRICvxe+WVoFVxHPS2rXFVJsh7i9U7cgoSrpLphFIr3P gsRw2Rdk0XgbxCBY8t8Pzk7lquMUhjzaSJPcLDOgsROIMJ8lRmIWS3odKiWkDRyQQkvB o/uDDpbOrWYowXIZsJBv7QLilwydPeC1RGVwPPplsns/QpO/t24RZ7Y/y9pfAtGhIXxc 48v5FUbc1S4YdjaD2dZV5pefuWuNJfG8/J1RhE/xRz1SIDa9gZfn5/fr2GHEhPqoRIRN N1qwQ5QWKOBwGcES3I9TJTPJKthnHKLVbFU+euDn6tQ458yBwoQHrtGpDrVbotRIgJn/ spYg== X-Gm-Message-State: AOJu0YxlMlZLcddu9XVl4mEwG6tSCOVDoGWnJ096oEfxAdgGwtX4tmsm Slw+8gkAfJskgl935OC+8ftKH6ST2qS95Yhpx5ug/uV7BEHQ+XjNCBuMiSitBahdnDRx4+UfNZL vSKnMSe65qoDTbmNKVG5khUQ8v6g= X-Google-Smtp-Source: AGHT+IHjEtDrFdqpX1jMQT8rC/VxA1n6Cl8cM4qCeSNIuMOFRxpZBPzoU6FP0+d9w2s6v+oIbkk7DXher16v1BR5GeQ= X-Received: by 2002:a05:6870:3290:b0:218:4c81:4f55 with SMTP id q16-20020a056870329000b002184c814f55mr3770700oac.44.1707236035956; Tue, 06 Feb 2024 08:13:55 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: =?UTF-8?B?Yg==?= <6562680@gmail.com> Date: Tue, 6 Feb 2024 19:13:20 +0300 Message-ID: To: Arvids Godjuks , internals@lists.php.net Content-Type: multipart/alternative; boundary="0000000000007892900610b8dd51" 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==?=) --0000000000007892900610b8dd51 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Btw, i agree about Javascript, but on a low level it produces the most clean code, because there's no types and rules. All types moved to TypeScript's client side compiler. JS 15 years ago ACCIDENTALLY created a pipeline. Named it "Promise". We spent years after to understand that while (true) and then/catch should be different patterns. =D0=B2=D1=82, 6 =D1=84=D0=B5=D0=B2=D1=80. 2024=E2=80=AF=D0=B3. =D0=B2 19:08= , =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>: > 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 - reducin= g > 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 implemen= t >> such thi g and require exte sive modifications for a thing that should b= e >> done on application level to begin with. >> >> And memory usage is one of the biggest points against it - engine >> allowing 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 l= ogs >> 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 whe= n >> people try to run bulk operations, do not disable trace logger and them = run >> 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. Th= ey >>> are now taking fun from it. We're tired of OOP for now. Once you work >>> with >>> batches/queue/bulks you need pipelines and chaining, and there's a thro= w >>> works only to stop any certain tasks and almost immediately catch the >>> next >>> 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 >>> this >>> is the hell of rewriting full nesting tree and carrying that return >>> statement to upper level again and again, then you start to get confuse= d, >>> 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 >>> inside >>> function directly like old good times $errors[] and if ($errors) { retu= rn >>> null; } >>> >>> >>> =D0=B2=D1=82, 6 =D1=84=D0=B5=D0=B2=D1=80. 2024=E2=80=AF=D0=B3. =D0=B2 1= 8: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 >>> "throw" >>> >> 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 = it >>> >> anywhere you need or re-`raise` again >>> >> - `raise` statement won't start to collapse/break code, so it could = be >>> >> skipped without affecting application >>> >> >>> > >>> > Is there an existing language that does that, having both exceptions >>> and >>> > 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 >>> >> > > -- > +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 --0000000000007892900610b8dd51--