Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61732 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42807 invoked from network); 25 Jul 2012 03:03:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Jul 2012 03:03:09 -0000 Authentication-Results: pb1.pair.com header.from=theanomaly.is@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=theanomaly.is@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.170 as permitted sender) X-PHP-List-Original-Sender: theanomaly.is@gmail.com X-Host-Fingerprint: 209.85.217.170 mail-lb0-f170.google.com Received: from [209.85.217.170] ([209.85.217.170:42987] helo=mail-lb0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BE/58-27263-CE16F005 for ; Tue, 24 Jul 2012 23:03:08 -0400 Received: by lbgc1 with SMTP id c1so326006lbg.29 for ; Tue, 24 Jul 2012 20:03:05 -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=qr60rSIxBlI/aHKwvlXyilFk0DDeD1ZddyMke4gkmSc=; b=adKWRGD0raMBXoSXiN1u62rcn3PD8ZVRYAqkTNXopy50mzoBlZCv9VVGuLtGkR4dzE bVTsUyzxpju3puO+aSsTOj1kVotB+2/Y4mdcJOefiXVIi8tnKKBDsKFRH04gflvcREJu jtTUB4nzcroJrDj+R8ganDE/0OtAOVEAMIR6J1e7s0j0di0YA1K+IkCEQfxpZoJqma5L /G0u3WMVwwjjL0kfpCcAnwQglC0vKcYYeFTqMCovK+VqhefV3M7pm2nDfv8Gp0cPOtPz Ik7tEHFXSzyWjAW/tl/mY4ZH5LV5irtUzmhVTXVpg83YGXoW0n1Br5wmVpjtq/e+Irye GsrQ== MIME-Version: 1.0 Received: by 10.152.105.173 with SMTP id gn13mr24057421lab.20.1343185385348; Tue, 24 Jul 2012 20:03:05 -0700 (PDT) Received: by 10.112.26.234 with HTTP; Tue, 24 Jul 2012 20:03:05 -0700 (PDT) In-Reply-To: <500EEA76.1030407@ajf.me> References: <500EDCC7.1020402@ajf.me> <500EE3B9.8010902@ajf.me> <500EEA76.1030407@ajf.me> Date: Tue, 24 Jul 2012 23:03:05 -0400 Message-ID: To: Andrew Faulds Cc: Alex Aulbach , internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Re: Generators in PHP From: theanomaly.is@gmail.com (Sherif Ramadan) > On 24/07/12 19:32, Alex Aulbach wrote: >> >> 2012/7/24 Andrew Faulds : >>> >>> But PHP functions usually have side-effects, they aren't strict >>> mathematical >>> functions. >> >> Ah, you might mean str_tok()? Are there more, do you have a list? >> >> But we're in PHP-programming-context. You write a function in PHP, you >> call it and it will return once called. I see there no exeption. >> >>> So complaining about this is rather pointless. >> >> I don't complain about the past. I just think now, that if it doesn't >> behave like a function it shouldn't be called function. A function >> which returns as an object and is not completed is not a function. >> >> And if other languages do so, my argument will be the same. >> >> We need not to make >> the same mistake again! :) >> > All the array_* functions have side effects. Most class methods, which are > also functions, have side effects. Most of the functions I write have side > effects. Much of mysql_* has side effects. > > PHP is not LISP. > LISP has side effects. > > -- > Andrew Faulds > http://ajf.me/ > > > -- Trying to solve cultural problems with the programming language rarely works. I don't think it contributes much to how well a developer will learn the use of generators with whether we use function or another keyword. With that said I believe that's the point of a discussion phase and I'd like to offer that we're free to implement it how we want. PHP made implementation mistakes in the past that led to awkward behavior (like objects passed by value in PHP4), but that's never stopped things from moving forward and offering up useful features that users want. I think putting the technical details aside the engine can aid a developer in distinguishing between spotting unintended side effects and preventing disastrous consequences. You have similar issues with developers that try to execute database queries while there are buffered results or developers that inadvertently write infinite loops. There are enough safeguards in place to help avoid such nuances.