Re: [Pre-RFC] Scalar object methods (with a working implementation)
| From: | Michal Kral | Date: | Sat, 04 Jul 2026 20:35:07 +0000 |
| Subject: | Re: [Pre-RFC] Scalar object methods (with a working implementation) | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-131770@lists.php.net to get a copy of this message | ||
Hi Morgan,
$sep|>explode(?, $str) or $str|>explode($sep, ?)Right, PFA plus the pipe covers a lot of the chaining, and the ? placeholder for argument position is nice. The difference I care about is what the chain binds to. $s |> trim(?) pipes into the global function namespace, so you get whatever trim / mb_trim / str_* happen to be, with their names and argument orders. $s->trim() is a small curated set defined on the type, so it autocompletes and the names stay stable. Different axes, they coexist fine. Pipe's the right tool for a lot of code. The methods just give primitives a small, discoverable surface for the common stuff. Michal