Newsgroups: php.internals
Path: news.php.net
Xref: news.php.net php.internals:94611
Return-Path: <david.proweb@gmail.com>
Mailing-List: contact internals-help@lists.php.net; run by ezmlm
Delivered-To: mailing list internals@lists.php.net
Received: (qmail 62853 invoked from network); 21 Jul 2016 12:39:36 -0000
Received: from unknown (HELO lists.php.net) (127.0.0.1)
  by localhost with SMTP; 21 Jul 2016 12:39:36 -0000
Authentication-Results: pb1.pair.com smtp.mail=david.proweb@gmail.com; spf=pass; sender-id=pass
Authentication-Results: pb1.pair.com header.from=david.proweb@gmail.com; sender-id=pass
Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.172 as permitted sender)
X-PHP-List-Original-Sender: david.proweb@gmail.com
X-Host-Fingerprint: 209.85.216.172 mail-qt0-f172.google.com  
Received: from [209.85.216.172] ([209.85.216.172:34393] helo=mail-qt0-f172.google.com)
	by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP
	id C7/6E-52781-782C0975 for <internals@lists.php.net>; Thu, 21 Jul 2016 08:39:35 -0400
Received: by mail-qt0-f172.google.com with SMTP id u25so42871522qtb.1
        for <internals@lists.php.net>; Thu, 21 Jul 2016 05:39:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=mime-version:in-reply-to:references:from:date:message-id:subject:cc;
        bh=fvUkI5/w3F+TPUE74ICOsZxn9fxwy13uMwqIg/D1mvc=;
        b=so+Owkk92WfxsehykTL9OIwTbaKsjq7lJL9fOZoxNEVEubHeqMPcQOOWIhCLPMEXfX
         uGvaEwsQDdOmLfYPwDrDN3U8EJJy0aF96xDabh0thp6eqBKdhKWwrLWRoTyY3LxCHzPi
         RA3p7WcJoXGmYwRFpiPoUgXyrxvbE6HpKwI0LVjGKINY7cSDfTVm9GZKaqhRzn/VFJlo
         H533o2fP6RNv16+9Zt2vT9JUTSctOHqWDfmCRWi+4XXdRNQ2lcObw295XgpTaBoKjCTF
         rWaB6S4pZgGUHfWjS06WLue1yFbk/ieLbpMcj14XuhUPAAxdwjWDv2RfaLgN08xfo46r
         AyAw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:in-reply-to:references:from:date
         :message-id:subject:cc;
        bh=fvUkI5/w3F+TPUE74ICOsZxn9fxwy13uMwqIg/D1mvc=;
        b=LvIWdRgo+Xik2pBVZ7i8G/2zVLoaIFmLIE1M7EaBIB7Z3Duwi5UOX69XPPpfmmC9Lz
         Tu5tqT07VwZcbxbePaetZETz9eAFAkZ8niFnI7f2pacoFo5b+U38GN4HFrNMsNCpRoS8
         i5kqYhz7xJfkgCEscnkqu9faNqprIVr7JzKfBm0wHaGlnT2Bf7+h9JCYyP3o0W7G2TPQ
         7gZNWRtavMpPV+ehpg2yaoYLmBO14tTE7Q0F4ak/MolwXuuC3d1XKNpdbE2Rz7M55olP
         u8ODgTrH2FbW8vXlG+QIcbWXQjXO0yU2ORJOZFbBVBc0Ll+258omKws1oSGjaWDCw4rP
         gjZw==
X-Gm-Message-State: ALyK8tJzUY47uX7eI9bUSGn9FWkVn8vpFGJKiSDlnuOWwFR+eh0M5HFQzKK4rPirspZjMnsdeGHbrniaWRAM1w==
X-Received: by 10.200.52.193 with SMTP id x1mr80832204qtb.65.1469104772967;
 Thu, 21 Jul 2016 05:39:32 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.55.45.67 with HTTP; Thu, 21 Jul 2016 05:39:13 -0700 (PDT)
In-Reply-To: <5786dd74-8a32-eb16-aec1-77b12d5af1c1@garfieldtech.com>
References: <CAESVnVoBrtfWGF-Be+uXWwLNO3=JzuLBXyhW0Dpo-NvoskofQw@mail.gmail.com>
 <5786dd74-8a32-eb16-aec1-77b12d5af1c1@garfieldtech.com>
Date: Thu, 21 Jul 2016 09:39:13 -0300
Message-ID: <CAEsg9X1F1Dfo_7FGgDHhGxA1ypsUE1qEbMkezTOVtJvgY+RcJA@mail.gmail.com>
Cc: PHP Internals <internals@lists.php.net>
Content-Type: text/plain; charset=UTF-8
Subject: Re: [PHP-DEV] Pipe Operator v2
From: david.proweb@gmail.com (David Rodrigues)

This is a great idea in general, but I think that this kind of
operator is not the ideal (expect for $$ that seems very good).

Some possibilities to think about:

|> (as suggested) seems strange and not very clear, mainly in linear calls
--> can be too long, but can make more sense or continuing, but can
confuse with simple ->
$> seems like terminal, but can tell like "keep this root-variable and
run it", bad for linear too
<- is short, maybe can tells "call it and return to root-variable", in
linear can be confused with "minus" minus operation ($x<-a())
=> is short, but can be confused why array syntax, but good for linear
.. (like Dart) is short, but can be confused why a (double?) concat,
not seems PHP in general (but still a good option)

Another option is make calls without define an operator, the problem
is that can be not clear or then cause break changes (very bad for
linear).
Or defining a new keyword, but it can be exhaustive or reduce readability.

Should be think about the linear readability too, for instance:
$object->a()->b()->c() vs. $object|>a()|>b()|>c().

Examples: http://pastebin.com/rguUSxDr

It can works to avoid matroska (as initial suggestion) but for objects too.
PHP should identify if this operator is used over object or other type
(that allows the use of $$).
The problem is it can be confused: are you executing an object method
or another function with the object?
Like in: $clockObject |> setHour(12) |> is_string($$). 'is_string' is
from Clock or PHP native function?

Example: http://pastebin.com/t79kjaHQ