Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99552 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 91119 invoked from network); 19 Jun 2017 15:16:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jun 2017 15:16:29 -0000 Authentication-Results: pb1.pair.com smtp.mail=ocramius@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ocramius@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.41 as permitted sender) X-PHP-List-Original-Sender: ocramius@gmail.com X-Host-Fingerprint: 74.125.82.41 mail-wm0-f41.google.com Received: from [74.125.82.41] ([74.125.82.41:34972] helo=mail-wm0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0A/58-13828-ACAE7495 for ; Mon, 19 Jun 2017 11:16:26 -0400 Received: by mail-wm0-f41.google.com with SMTP id x70so79339631wme.0 for ; Mon, 19 Jun 2017 08:16:26 -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=Dj76osH26urkBNUcPnCGr1kTZmKCRhEGte0Zgbqs4x4=; b=qBht8lZfdNycdaZ5q1/Wc+NgjtKMSzqyRMpMcuWWNIpysnflN4m0NO78gqL16nIRBO wJ6MRukhs50XdBv/vXh6SZpQTEdj0tMRQRO44M5/f73QixwkSh5mPtSfdZGgnK2xmEA0 smJjGyO4GBQepR/nfoh2MkHSEzdQX5/R6hKvfX7UJmLE9fRweZm+LW+JDo/IoI1B/LP5 Lp5kDWzLKoMxx+bXvrASGvefJsQImlYcLFfndLhMDmEsqyUBjDyZwxPIniq3JuY0J8Ys 9uQd8AIhEDK7tKlwhCIwD/eXJu0yWy0ynVIvZ+UDAGsaRbjWqZsCozg677lkNhZFmG0M xF6Q== 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=Dj76osH26urkBNUcPnCGr1kTZmKCRhEGte0Zgbqs4x4=; b=ZP++m9GxfNpalMxaNUqb2gFd1FBHTNxkxHir1iSeCfH12RljIZsGqLL7JqPGXp++bA 1QfSN1UhK8jUv1DQY0/wagDXkt3LY1QUJrYNDhNH+Zr0uT4jTx5J+mEQ9zxu5kBd0CMH jXr6MzitRBInddZaeTxC6Q1KCnmT+beoZoGhcqZ+pBB9VHNj3TvBE5qPdl7jB+zUwi7e ylaTZVi75oBDoAaRLlgYFFXyn/v3IDCteKM8mS229Q1wWNickQgtR3ENKpJhOGy9fq0E O11CmgBGX24lq38Y8sEzHBDeM/18qCf1Fn+ZiHAxRlHHd4FAFtnr7UQac6PiKoCEtis/ 0Ixg== X-Gm-Message-State: AKS2vOy+UZ0eZpZrgHJLevRoPsZjo70JhopiwORC5Wsojwhh3fP6Vl56 38EriWnrDtC+ZfPwxemTN7YwXtZ3rO05xgg= X-Received: by 10.28.230.89 with SMTP id d86mr16598768wmh.80.1497885382615; Mon, 19 Jun 2017 08:16:22 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.161.153 with HTTP; Mon, 19 Jun 2017 08:16:02 -0700 (PDT) In-Reply-To: References: Date: Mon, 19 Jun 2017 17:16:02 +0200 Message-ID: To: Sammy Kaye Powers Cc: PHP Internals Content-Type: multipart/alternative; boundary="001a1147c4b0252ec10552519eca" Subject: Re: [PHP-DEV] [RFC] [Discussion] Retry functionality From: ocramius@gmail.com (Marco Pivetta) --001a1147c4b0252ec10552519eca Content-Type: text/plain; charset="UTF-8" Hey Sammy, From a language design perspective, this is syntactic sugar that brings a lot of cost for anyone working on optimisations. In most scenarios that I worked on, the retry functionality should always be written as following: try { $externalCollaborator->doSomething($with, $a, $lot, $of, $by, $val, $parameters); } catch (SomethingSomething $e) { $externalCollaborator->doSomething($with, $a, $lot, $of, $by, $val, $parameters); } The reason why it is extremely important to have an external collaborator is that logic wrapped in a retry *MUST* be tested for idempotence. Just imagine what could happen if a credit card payment was processed twice! That said, the above can be rewritten as following: retry( function () use ($externalCollaborator, $with, $a, $lot, $of, $by, $val, $parameters) { $externalCollaborator->doSomething($with, $a, $lot, $of, $by, $val, $parameters); }, [SomethingSomething::class], 1 ); Where the signature of `retry` is as following: function retry(callable $executedLogic, array $caughtExceptionTypes, int $maxRetries) { /* ... */ } This kind of approach is simpler to understand, to test, and doesn't include the "hidden GOTO semantics" that are proposed in this patch, and that would make SSA optimizations quite hard to perform. Given the above, I'm sadly going to vote "NO" on this proposal. Greets, Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ On Mon, Jun 19, 2017 at 3:55 PM, Sammy Kaye Powers wrote: > Hello internals! > > The RFC that proposes adding retry functionality to the > `try/catch/finally` block is now officially "under discussion". > > https://wiki.php.net/rfc/retry-keyword > > Voting will open on Monday, July 3rd, 2017 @ 9 am CDT. > > Voting will close on Monday, July 17th, 2017 @ 9 am CDT. > > Discuss amongst yourselves. :) > > Thanks, > Sammy Kaye Powers > sammyk.me > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001a1147c4b0252ec10552519eca--