[PHP-DEV] Re: [Pre-RFC] Scalar object methods (with a working implementation)

Michal Kral <[email protected]>
Newsgroups gmane.comp.php.devel
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.