Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94496 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5050 invoked from network); 13 Jul 2016 02:12:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Jul 2016 02:12:49 -0000 Authentication-Results: pb1.pair.com header.from=jesseschalken@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=jesseschalken@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.51 as permitted sender) X-PHP-List-Original-Sender: jesseschalken@gmail.com X-Host-Fingerprint: 209.85.214.51 mail-it0-f51.google.com Received: from [209.85.214.51] ([209.85.214.51:36710] helo=mail-it0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EB/30-17655-C93A5875 for ; Tue, 12 Jul 2016 22:12:46 -0400 Received: by mail-it0-f51.google.com with SMTP id f6so9371406ith.1 for ; Tue, 12 Jul 2016 19:12:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=vPfx6v12lSVbWWC9bwX74x+fYH3iuC9oLBtVqNP43V4=; b=jmYcDVrqh03P5P/dP4C5zexf+RQI2MYut0gnIUDjmAxhIHNbPJrHkRxYYJRtbwe2+R TMQdYfQcg4rOJ1ptuDhACwHYNVuwQbtO0eyAHG76I3jS3WzPFxY88hb25TP1RBI1yv6M dlOz6XayQr4hPcKY6pfzkP9dGiAQ4bJGDKMHZ+91qP2mZ9LrInu947wxbOBl+NDyNCzA vOYFzS373CoQqTJnB7ZJx0VAypVkT6z12MUlCQ0PWWsz0D2U0OKlbSMuHwtIshEEXjck v/g2PXh2VbuIRnRpDsSLogc0kakV0RaOWXF/Z5Wfs1eViDS0OsaTDrZnbMzxEmw1+heJ nabw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=vPfx6v12lSVbWWC9bwX74x+fYH3iuC9oLBtVqNP43V4=; b=mTHbURkNlftM8TEHqxlZxHv08pAhnY+wnafj3Je+vGe5zYnaPZeLkb7BkdJdFDtqN0 kxvasJax4SdxTc5Tp1fenLiUMEsjrD27VPxJQNNGI5AmPe3VQXGraQB6GSKzNIZp//zM kYi5RibXOXigoFqEZRnDYZ9CCNMlX1u/4O6tSoXeAjPeD5yxUMdkQ5nQgzU08TmYWOQR Uq3HKXlS8OoqJWkbuIERePhNf5rtJJq5Hv+vmmt6bj0DFxDbH+/HwkaGIdgmWgVgv2g7 pFktc8xqsEmbNWWHuAzU+mBu3K9iv4r0d2BTD+wZQ+8YIw3i2GvHNn3s4WlFtvji66cm oy7Q== X-Gm-Message-State: ALyK8tKLGTFPP0OiIpaH64bDJ1Xho2nfgb19Pp13V8Jcr54kOjvrZlWKWUc0EaKXNJ9pSCMzf+XWYopwD1WUPQ== X-Received: by 10.36.208.143 with SMTP id m137mr12591002itg.32.1468375962528; Tue, 12 Jul 2016 19:12:42 -0700 (PDT) MIME-Version: 1.0 Sender: jesseschalken@gmail.com Received: by 10.79.95.195 with HTTP; Tue, 12 Jul 2016 19:12:41 -0700 (PDT) In-Reply-To: <33e06ab7-ec7b-0cc0-d724-ede441df6c89@gmail.com> References: <86455a1e-eb57-1f30-9016-ac70c9f30bdd@gmail.com> <33e06ab7-ec7b-0cc0-d724-ede441df6c89@gmail.com> Date: Wed, 13 Jul 2016 12:12:41 +1000 X-Google-Sender-Auth: izn3IGpkD8vSZqzA2R55fyWtwmk Message-ID: To: Rowan Collins Cc: PHP Internals List Content-Type: multipart/alternative; boundary=001a11479d90a4d44b05377aeb23 Subject: Re: [PHP-DEV] Cascade Operator (was Re: [PHP-DEV] Proposal for php7 class method return) From: me@jesseschalken.com (Jesse Schalken) --001a11479d90a4d44b05377aeb23 Content-Type: text/plain; charset=UTF-8 On Tue, Jul 12, 2016 at 6:36 PM, Rowan Collins wrote: > > Thinking about it, this becomes something more like a "with" keyword: > > with ( $counter ) { > count(); > count(); > count(); > count(); > } > > The semicolon suggests those lines are arbitrary statements, in which case it's ambiguous whether count() is a method or a normal function. And what if I want to call a function count() but $counter happens to have a count() method I didn't know about when writing the code? That's why I used a comma, to be clear the lines are *not* statements but rather only things that can go on the right of "->" (property access (assignment) or method call). The lines have their own definition, like the lines of an array literal do. I'm not sure if this is a good thing or not - with() statements exist in a > few languages, with varying degrees of acceptance. I don't remember seeing > one used as an expression like that before, though. > I'm only aware of the "with" statement in JavaScript, which is considered a real language wart because all it does is take an object and adds it to your scope chain, so that without knowing precisely what properties the object has, you can't predict what local variables are going to be masked and which ones aren't. There's a definite awkwardness of what to put on the left side of property > assignments too... > > with ( new Foo ) { var = 1 } > with ( new Foo ) { $var = 1 } > with ( new Foo ) { ->var = 1 } > > If the definition of the lines is "what can go right of ->" then it follows that the first line is correct, which also happens to be the most concise one :) . > > Overall, it's an interesting idea, but the details are fiddly, and the > gains marginal, IMO. > > I think the details are only fiddly if the lines can be arbitrary statements. > > Regards, > -- > Rowan Collins > [IMSoP] > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001a11479d90a4d44b05377aeb23--