Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62141 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90086 invoked from network); 14 Aug 2012 12:02:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Aug 2012 12:02:21 -0000 Authentication-Results: pb1.pair.com header.from=alex.aulbach@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=alex.aulbach@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.170 as permitted sender) X-PHP-List-Original-Sender: alex.aulbach@gmail.com X-Host-Fingerprint: 209.85.160.170 mail-gh0-f170.google.com Received: from [209.85.160.170] ([209.85.160.170:56082] helo=mail-gh0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 71/47-00812-C4E3A205 for ; Tue, 14 Aug 2012 08:02:20 -0400 Received: by ghbg24 with SMTP id g24so348681ghb.29 for ; Tue, 14 Aug 2012 05:02:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=sCRPFXYNEgLEqd9fVaiilfF67Z1ACaMzSJDGI7GnPUk=; b=iuc7iQC5hO9B0dEXt8uUo1hPBWYp7jQ1tTzMms0X79GxSZetWmwtkMExuB1yMYgrVt a/pbAkKMAkyRAjqr7KjA6+EC4dfEY74qAPAOMGEe42J8gtS2pEncRtZJgwlZLjXqjm+D eyyJaIkZT93HrG1kWh8nS1uvsHXxcQ3M7GtBPyhMK6YSoASnE6PKBR6Nhlc3AtJQmUTn whKqJySQ/ImJxo3PPe5PBf0QF+q0hu+jZDoChxKgZyK9IuZoLviAaQkeQ2aJ5HjgLQJm KY0Fdl5chE04NPCrIPK2sTx0gH5tnZ6+FKnzeQOZk+UHaGNJjYce0RcP1iGrTilQY+9c w91g== MIME-Version: 1.0 Received: by 10.50.219.161 with SMTP id pp1mr11372940igc.19.1344945737452; Tue, 14 Aug 2012 05:02:17 -0700 (PDT) Received: by 10.64.141.36 with HTTP; Tue, 14 Aug 2012 05:02:17 -0700 (PDT) In-Reply-To: References: <50280D37.10109@moonspot.net> Date: Tue, 14 Aug 2012 14:02:17 +0200 Message-ID: To: Anthony Ferrara Cc: Brian Moon , Nikita Popov , PHP internals Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] [RFC] Generators From: alex.aulbach@gmail.com (Alex Aulbach) 2012/8/13 Anthony Ferrara : > It's absolutely something that takes getting used to. But it's also quite > intuitive once you think about it. You're not "returning" back to the > parent scope (exiting your scope), you're "yielding" a value to the parent > scope, expecting to continue on later (think of it as a stop light where > you let the other code run for a while until you go to the next one). I think for people, which are - like me - more used with databases, the cursor-concept is a good comparison. Perhaps this could help a little bit to explain it... -- Alex Aulbach