Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97975 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 20889 invoked from network); 26 Jan 2017 20:56:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Jan 2017 20:56:08 -0000 Authentication-Results: pb1.pair.com header.from=rasmus@mindplay.dk; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rasmus@mindplay.dk; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mindplay.dk from 209.85.216.181 cause and error) X-PHP-List-Original-Sender: rasmus@mindplay.dk X-Host-Fingerprint: 209.85.216.181 mail-qt0-f181.google.com Received: from [209.85.216.181] ([209.85.216.181:33975] helo=mail-qt0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E3/A2-28703-6626A885 for ; Thu, 26 Jan 2017 15:56:06 -0500 Received: by mail-qt0-f181.google.com with SMTP id w20so35140550qtb.1 for ; Thu, 26 Jan 2017 12:56:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mindplay-dk.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=2BIQjz0ho9KY8XhccT9K9IEx5IAkbvtu71D07VUey4M=; b=tZ+NAdKwFkHn9GK0h18nNMUuBvjfYYPFjplD/ADcn5mXJpR/8uDQLjiOwwXunjfhDG 1tnFMeykTOAHiYH7kjuYvFqMBZyii4ZWuZwhsi6kOp26bp0+Wli8BqXs7WCpy1wsVdZg DuyYnlQnHpsPQ/MFP+LEfJWl7mQ9US812PSWfocHMIIGx5LY02wi697Z4nyriWN3KBb2 a4mDDrWR4cACG76UFUFOhDOmoOR5ID5OaiTj1n3S09sFS2C6Tz/9OZ0wTZ1PCJm5BaQi bbCMMAy56u4RN1i8LBbaiV53nBCoksOJSDJA7RdUfUFsehMT7Oc2F1TytHz82l20qnNS NkCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=2BIQjz0ho9KY8XhccT9K9IEx5IAkbvtu71D07VUey4M=; b=BxX9yUZ9EbR8f8BWR7RnG/CiSrh6U4WkrJ9G2cr7tvcgeIunRJUT4ENAZhoRHcZmxB aDChNTZnaNdwAP/8fgBuErquk5Ry7ujpmITP+mRQCBxZ+PpOrNiHc9/YlXk9RGoC9gMs 3X6l1dQYypeolufieTsP6f4wzai0bQDs7qV7fZLfLXrXmd3s+1vBZQGQ+REuwMxbM9pp xFAbscU3+sPpkKKjOV1vUpDNBO1QwJMd4HGcgQWLmSudTqePJugkRt1mFFY9uFSbCMeK ELA6OJDu53WzZHffHBJG5dyou0kZrdNMpgOTCbxj4gDivgnhio14RPmSvgvfhRf5SDc7 7xMQ== X-Gm-Message-State: AIkVDXIebvlg+RUhbExRef0vjYLstDvf70gwE4875zE0ow3OEr8UU1md10VJv8RRKrip8ynquOIyRG2SzhFyRQ== X-Received: by 10.200.47.129 with SMTP id l1mr4607509qta.148.1485464160756; Thu, 26 Jan 2017 12:56:00 -0800 (PST) MIME-Version: 1.0 Received: by 10.237.47.231 with HTTP; Thu, 26 Jan 2017 12:56:00 -0800 (PST) In-Reply-To: References: <52a7238f-af22-8960-c829-b1d4ba1bbfdc@free.fr> Date: Thu, 26 Jan 2017 21:56:00 +0100 Message-ID: To: Stephen Reay Cc: Levi Morrison , =?UTF-8?Q?Fran=C3=A7ois_Laupretre?= , Sara Golemon , PHP internals Content-Type: multipart/alternative; boundary=001a113776f2a10490054705933e Subject: Re: [PHP-DEV] Pipe Operator v2 From: rasmus@mindplay.dk (Rasmus Schultz) --001a113776f2a10490054705933e Content-Type: text/plain; charset=UTF-8 Besides, I mean, I'm sure this has occurred to everyone, right? https://gist.github.com/mindplay-dk/4ef61fd5c0a35e5aa8fc699febb86487 I personally find that this new syntax you're proposing requires a lot of parsing. I mean, whenever you see substr() or array_map() etc. you're intuitively expecting the first argument to be the first argument, right? Now you have to backtrack through other lines and figure out the context, or try to spot the $$ and count arguments to figure out which is which. Just using intermediary variables seems pretty straight-forward and harmless, so that would be my personal preference - if my coworkers started using this everywhere, I would likely refactor the code and introduce more variables in the process of trying to parse and make sense of it. IMO, shorter, isolated constructions are always easier to read, write, understand and change than the much longer constructions with the new operator shown in the RFC. But I also stay away from fluent APIs for the same reason, so there's that. Maybe it comes down to personal preference - it's definitely not to my taste, sorry... On Wed, Jan 25, 2017 at 7:06 AM, Stephen Reay wrote: > As a userland developer I feel $$ (or some variation starting with $) is > reasonably natural - it's a variation on a regular variable. > > > > Sent from my iPhone > > > On 25 Jan 2017, at 03:53, Levi Morrison wrote: > > > >> On Tue, Jan 24, 2017 at 12:25 PM, Rasmus Schultz > wrote: > >> Isn't `_` more generally used as a "discard" placeholder in most > languages? > >> > >> At least in Swift, Go, Scala, Dart and C# (starting with v7) I think? > >> > >> I don't recall having seen it mean "fill in the blank". In what > languages? > >> > >> > >>> On Fri, Jan 20, 2017 at 4:26 PM, Levi Morrison wrote: > >>> > >>> Oops, sorry for an email that just quotes others; mis-clicked send. > >>> > >>>> Last, a cosmetic suggestion : replace '$$' with '$<' (more explicit as > >>>> 'input data', imo). > >>> > >>> If we aren't going to use `$$` I'd like to use `_` or `__` which read > >>> similar to "fill in the blank" and has precedence in other languages. > >>> > >>> But at this stage I'd much rather focus on changing the general model > >>> to what I've proposed instead of what is outlined in the RFC. I care > >>> much more about the feature than the exact syntax for it. > >>> > >>> -- > >>> PHP Internals - PHP Runtime Development Mailing List > >>> To unsubscribe, visit: http://www.php.net/unsub.php > > > > Scala does use it this way. It also uses it in pattern matching to > > mean "match anything else" or "I don't care about this one". > > > > -- > > PHP Internals - PHP Runtime Development Mailing List > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > --001a113776f2a10490054705933e--