Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60905 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 50499 invoked from network); 20 Jun 2012 12:55:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jun 2012 12:55:23 -0000 Authentication-Results: pb1.pair.com header.from=dmgx.michael@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmgx.michael@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.54 as permitted sender) X-PHP-List-Original-Sender: dmgx.michael@gmail.com X-Host-Fingerprint: 74.125.82.54 mail-wg0-f54.google.com Received: from [74.125.82.54] ([74.125.82.54:51117] helo=mail-wg0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A0/24-25489-A38C1EF4 for ; Wed, 20 Jun 2012 08:55:23 -0400 Received: by wgbfg15 with SMTP id fg15so5836945wgb.11 for ; Wed, 20 Jun 2012 05:55:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=vwZU896lP/a/soO04zxRoGosckWpUz1KZtlN0KVqavI=; b=YwfCDQob+mbvgFznsvzBuAIXd327DisjQfGY0eaQsV8DR/hvm0m5u4iDMKZ3w8DvZJ EH2uxjHQyzkwZ/Kp4vDfmXOnpZefjVy3UgJCOMajlMU1AgwWdllGDetjZ9g/IKMWL7Eb pWi3ob8Br/HSebXVgDnzAelluY9MLFu65gnG+7C/msx44ALW/tinv1ZR0FuSuxSRgVde MNSaA+wem0p8hBdeTdZVrfBMzlJaNUj5A+6pDX76pn4x3nQwQjYrL1Yp5Dp50/Al0XV4 RIdOmSFKm36+Mo+kfE2zRe8qlt+dtgC9kioS1TElK1Z4E+RorQkgcms6bCwtRwv+kpJM xqNA== MIME-Version: 1.0 Received: by 10.180.109.195 with SMTP id hu3mr11946717wib.8.1340196920185; Wed, 20 Jun 2012 05:55:20 -0700 (PDT) Received: by 10.216.202.16 with HTTP; Wed, 20 Jun 2012 05:55:20 -0700 (PDT) Date: Wed, 20 Jun 2012 08:55:20 -0400 Message-ID: To: PHP Internals List Content-Type: text/plain; charset=ISO-8859-1 Subject: [PHP-DEV] Resume keyword From: dmgx.michael@gmail.com (Michael Morris) I can't get this out of my head after two weeks, but some part of me says this is a *really* bad idea. Of course another part of my brain things its a great idea and I'm getting tired of the argument. Resume is similar to return, but can only be used in catch blocks or in error handling functions. When encountered the run time returns to the line after the exception was initially thrown and, well, "resumes". If resume has a value, and the exception was an assignment operation, then that value is assigned to the variable. The part of me that likes this idea points out it allows exceptions to behave like PHP errors when that behavior is wanted. It would also open the possibility of converting all engine errors to exceptions, because a mechanism would now be in place to handle exceptions in BC manner to errors would be in place. Further, the default exception handler could call resume after echoing on the non fatal errors. The part of me that hates this idea is concerned with how it could be abused to create even more nightmarish spaghetti tangles. An example for additional clarity. set_exception_handler(function ($e) { echo $e->getMessage(); // Don't know if this is correct - but should be able to illustrate here if ($e->getCode() == E_NOTICE & E_STRICT) { resume null; } echo 'Dying now'; exit; }); throw new Exception('A test', E_NOTICE); echo "We didn't die"; The code above when run would echo "A test. We didn't die."; I leave this to smarter people than me.