Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120850 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 53409 invoked from network); 19 Jul 2023 14:35:17 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 19 Jul 2023 14:35:17 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E7DF51804C9 for ; Wed, 19 Jul 2023 07:35:15 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS29838 64.147.123.0/24 X-Spam-Virus: No X-Envelope-From: Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 19 Jul 2023 07:35:15 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id CC5AD3200564; Wed, 19 Jul 2023 10:35:13 -0400 (EDT) Received: from imap50 ([10.202.2.100]) by compute4.internal (MEProxy); Wed, 19 Jul 2023 10:35:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; t=1689777313; x=1689863713; bh=Ys4HeeRSJy TQwI0fACIJLQi6wwN0hkicUdAOnmbmkuQ=; b=kzW5UhRftFJDGXHGYkSUbH5L1y nXxtVQ37wcfCGphdnDEgjjlsMJAKw9Mxd/yEW8zZgf/UajTEScf2ePkGhFFGlLmU FQTSjSvbEXqlYDG9GlJ7dlQ5/FyTsxCTFPmEQbONfE0Y7nDApb+HlUBA38lMp53V dkng5sxqJ3yQt35NU6H7eH+akadXE0CKqSrvdqhQkeSoG2OdlOnlPrnBDWobpV3F 0WK2wEsT3aN2aN5LDEl1S9FE2xnlakULYhBm3T/FJAuskPrP6fM1RxWz+b5Ezmbd B7oU4zDlnP91TtRWy1vkNC4BCVJ1Nrv0IM+UFTjKVi+Tk+eYP5l6G2mxaLug== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1689777313; x=1689863713; bh=Ys4HeeRSJyTQwI0fACIJLQi6wwN0hkicUdA OnmbmkuQ=; b=u0/69jwJqyBe7sP5MOq7iJGGc7iT7wI4jD/Cav/RmesAOm46iJw ov2yWPEZZyeBOqpKDSkQsXPyfDKv0S5yEmiIe+fgyg7LkRuTA67dPz/mhVt/vunG xDmSSBAiT1vmiS5ulYIuPfr/to+qrsFgop7LK0MrdkvzdHJSuZNumqeVXO7M/mQN HTiF/Ley9Z1TBrtI5l5s1k0xCj6jnITFJeLZCilZlHTdDgvlL6nM33+XawbJwp6U F4Tonp8MR/Q/C5Y/T6RyUEBfa8o4sYEkbXCQWYP5zEy56c6uZSheEbGlP6/53oe/ otQMGKUjYk70FM9q5pW1JVmc/imqpq12LeQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrgeekgdeivdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvvefutgfgsehtqhertderreejnecuhfhrohhmpedfnfgr rhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtg homheqnecuggftrfgrthhtvghrnheptdelfeekjeetleejveejffehffejfeefheekledu hfeukedvheffvdevffejhfffnecuffhomhgrihhnpehpvggrkhgurdgtohhmnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgr rhhfihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id E95BF17000A2; Wed, 19 Jul 2023 10:35:12 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-531-gfdfa13a06d-fm-20230703.001-gfdfa13a0 Mime-Version: 1.0 Message-ID: <64315dcc-9f78-4d8d-bc02-dfea5c725bda@app.fastmail.com> In-Reply-To: References: <8055b366-32f1-4d2c-85d0-0cf665e6c8d3@app.fastmail.com> <51a97131-f64e-4939-9339-24e70873fe32@app.fastmail.com> Date: Wed, 19 Jul 2023 14:34:49 +0000 To: =?UTF-8?Q?Olle_H=C3=A4rstedt?= Cc: someniatko , "php internals" Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] pipes, scalar objects and on? From: larry@garfieldtech.com ("Larry Garfield") On Wed, Jul 19, 2023, at 12:08 PM, Olle H=C3=A4rstedt wrote: > 2023-07-18 18:50 GMT+02:00, Larry Garfield : >> On Tue, Jul 18, 2023, at 4:47 PM, Olle H=C3=A4rstedt wrote: >> >>> Any comment on a pipe (or piped process) as a first-class value? When >>> you use |> the functions are immediately applied, which might not be >>> what you want. You can lazify it by wrapping it in a lambda, but I >>> think that decreases the value of the pipe concept in itself. One >>> strength is the ability to split the decision about what to glue >>> together from the decision on how to execute it. You kinda get some >>> light-weight metaprogramming ability that way. >>> >>> Well i guess such a pipe-concept is pretty far removed from the simp= le >>> pipe operator. :) And also already possible with existing OOP >>> concepts, callable classes, and now the (...) syntax. >> >> That's the function concat operator I have been mentioning. Concat c= an be >> implemented in terms of pipe, and pipe can be implemented in terms of >> concat, but I'd rather have both natively. >> >> For more on my thoughts there, see: >> https://peakd.com/hive-168588/@crell/aoc2021-review > > Right, I think I was thinking more of the pipeline design pattern than > the pipe operator. The concat operator will tell you THAT two > functions have been glued together, but you have no way to affect HOW > they are glued together. With the pipeline design pattern, you do: For > example, you could add a logger that logs each input and output in the > Pipe class without much hassle. > > The pipeline design pattern could still greatly benefit from some of > these RFCs tho, especially partial function application, I think. > > Olle OK, terminology mismatch. What you're calling "pipeline design pattern"= I'm calling "that's literally what a monad is." :-) (More precisely, m= onads are the mathematical rules that a "fancy function concatenation" o= peration has to follow in order to still be composable cleanly. You cou= ld make pipeline-like things that don't follow those rules, but they'd b= e less useful.) Your logging example is literally the "writer monad," one of the standar= d monad examples. --Larry Garfield