Re: Discussion: String streams
| From: | Katie Volz | Date: | Tue, 22 Mar 2022 15:40:36 +0000 |
| Subject: | Re: Discussion: String streams | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-117399@lists.php.net to get a copy of this message | ||
>
> I'd build this in userspace, but of course we don't have operator
> overloading, so the API would be a somewhat uglier function call:
It is currently possible to get operator overloads in userspace using FFI
(using my fork of lisachenko's z-engine to FFI into PHP calls). I made a
quick prototype implementation: https://github.com/iggyvolz/sstream (of
course any IDE or static analysis tool is going to yell at you for writing
object << string but it works) . Whether to use << or <<= or
>> or >>=
is up to debate but the general concept of "$x << $y calls $x->append($y)"
is there.