Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93042 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11647 invoked from network); 3 May 2016 18:12:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 May 2016 18:12:45 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@golemon.com; spf=softfail; sender-id=softfail Authentication-Results: pb1.pair.com header.from=php@golemon.com; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain golemon.com does not designate 209.85.215.46 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 209.85.215.46 mail-lf0-f46.google.com Received: from [209.85.215.46] ([209.85.215.46:33429] helo=mail-lf0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 24/F4-03860-C1AE8275 for ; Tue, 03 May 2016 14:12:45 -0400 Received: by mail-lf0-f46.google.com with SMTP id y84so32143069lfc.0 for ; Tue, 03 May 2016 11:12:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golemon-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=+ZyU06sGhvyqmv4tPz7zH6kU3tw9TsJv9pMcXxUBNNQ=; b=k7x2kUbP2UsjqkFjUzQU5OYB9lquayJIl183uWccOcMxxrGPhjO96Pyw1FmRsYUSsv wh5T54+qjiYNYR4lGdZ7fIKx3rqMdRRC9yfL0lbYJxK7KxO+fe2y95m3iT4fsBsqmme6 tJOhVXSK7GzJaOnsokgbRcbop2lq0D+HMoDU+/RFBF9hqF8fJwGjL1icuZudbmSMxDe5 9eK2AQpzwOdX0CBd5UX1c/Z7uZ7zcnKkw1Ixgp0ItylmPt9frgN7S24mNnCDSq+Zuvb/ S7dVqgsWUlfAYz4mxEziEyZDvppwTDyoU02r2nWhOss2vCCHPwlLTEO4n2HNtqH9t9+L jblg== 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:date :message-id:subject:from:to:cc; bh=+ZyU06sGhvyqmv4tPz7zH6kU3tw9TsJv9pMcXxUBNNQ=; b=bqZH3nWSMSByFgCKlTjMU9WwUxVe72BDhxH2lC2SzLZgaMMPN+2ggR9h9RmOPW47eN BhB8V1MeU7Fj53JZQl5YIiFEkpQB0a3QEeTksTWzSFFv4h4VtyGlw1FfDSc4RZEbhXYq hd/bvnxoI66RBYBbjlGu9VhC+S9GoUiCfOBZkBq5k9RqfnNUGq52AsP0ZIcUsTMC7elA 11qAGRI0oRL4mfU9sFPVjEbttsgbWO1Zr8W/aG0JvAguDqb74cFAMYGBTQmMpBc0ByFu BuZ0onmHxgx2UCvwXMmLcR6rsUFhfqusXJ5hKaTQZXxtMLltF+OWjH6uzn4xDzbnTshH iGQw== X-Gm-Message-State: AOPr4FXP2WykPB9DKVLGlCelIdLRhR2kRrU2tHlK8yhLl08aQpA6ACgcAwdkJD5NIR5mFQR7b0ugsX3uX4MG9A== MIME-Version: 1.0 X-Received: by 10.25.169.144 with SMTP id s138mr1930300lfe.108.1462299161747; Tue, 03 May 2016 11:12:41 -0700 (PDT) Sender: php@golemon.com Received: by 10.112.19.72 with HTTP; Tue, 3 May 2016 11:12:41 -0700 (PDT) X-Originating-IP: [107.198.91.68] In-Reply-To: References: <4fc01507-3d07-2309-a4e4-4cad7325249b@gmail.com> Date: Tue, 3 May 2016 11:12:41 -0700 X-Google-Sender-Auth: CK94NIKsFotxL2_K1HwJ0P42XDo Message-ID: To: PHP internals Cc: Terry Cullen , Stephen Coakley Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] Pipe Operator From: pollita@php.net (Sara Golemon) On Tue, May 3, 2016 at 9:30 AM, Fleshgrinder wrote: > On 5/3/2016 4:53 AM, Terry Cullen wrote: >> Doesn't Nikic's scalar objects (https://github.com/nikic/scalar_objects) >> more or less achieve the same thing while also cleaning up the std lib? >> >> $ret = scandir($arg) >> ->filter(function(){}) >> ->map(function(){}) >> ->merge($someOtherArray); >> > > It is indeed a much better approach. The more I read and think about the > pipe operator the more I am against it. > The difference with scalar objects is: A) We need to agree on what methods these objects are going to have. ((And we won't agree)) We could maybe hedge our bets with a ->invoke(Callable) method that pushes the value into an arbitrary closure, but that's just adding complexity to... avoid adding complexity... o.O B) It's not just about scalars. $foo = SomeLibrary::create(...) |> SomeOtherLibrary::render($$) |> $foo->send($$); Scalar objects don't help this case at all, and since the object instances are coming from some third-party library, making them instantiate extended children instead isn't necessarily a trivial thing (arguments about poorly designed libraries aside). I like the scalar objects approach as well. Heck, I wrote one three years ago: https://github.com/sgolemon/objectifier but I don't think it solves the same problem space as pipe chaining. -Sara