Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97529 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55169 invoked from network); 6 Jan 2017 16:48:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Jan 2017 16:48:04 -0000 Authentication-Results: pb1.pair.com header.from=ocramius@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ocramius@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.53 as permitted sender) X-PHP-List-Original-Sender: ocramius@gmail.com X-Host-Fingerprint: 74.125.82.53 mail-wm0-f53.google.com Received: from [74.125.82.53] ([74.125.82.53:37029] helo=mail-wm0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EF/D4-23307-24ACF685 for ; Fri, 06 Jan 2017 11:48:04 -0500 Received: by mail-wm0-f53.google.com with SMTP id t79so37634245wmt.0 for ; Fri, 06 Jan 2017 08:48:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=R75FCVTKwtz2+E0kra+NV0jXsldpHCve2pWK671W53I=; b=ucf7Tk83HgtzKJNKJ/JXWU8+86CCYvF6xhAzFCjALLTTbxVH1mi8lyfBJAECciJ5Z6 f0duivYV7JtGwrIIoX4CxhISsk0zBfCgFZ7HIx1Zhe+hl4VjYtxJY3bKRjcJ+xN1dHiN Tp/fEN83liChj5/l1ZpB+Hqx3XhGdHqkiTeXDxwMaup90rys6Cqp+S1GwoPtXYqhK4h/ qAMOGdXduPVHuMuGkmme3MgvEix0N6zPMLLbDD7nfn37aHcovl40UFMWzy/c7wAi6FU+ zE9ebUg9yTv1pqB88me5SZV0ZoDIY0teXw0/8/hf+DY9QVx/erbsWBO2Qhg73G5HfAB+ Qqhw== 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=R75FCVTKwtz2+E0kra+NV0jXsldpHCve2pWK671W53I=; b=qk5SshxcVQWtbqgwK0FK+5dLW+t1g6YZpAnwb3tJlS1G4a7Qx7aliYZu3Pw+x7MdYm BhRT57CJyHghj7ppk6GJQyl9zlHHKP+RQQo2/z0S74+MLU/zE0UdIomjs+hNTYgIc8B0 7QE5f5Y+PryQ16BqRv+C2/3FylrvfblIRkPZrKNKmHtszpw5bfJui1R9wF0NYRHroZbO sDIuD1Oqqf2V8feyA2JT87TCa7cgri3nRf/o2nGglUUi418IZUt1NF36DKnwrdqf3dSS mMz0LorVV5nQctrjPv6DIvfemo8NQ6WywQbe5a6GwBw4qeP2QqJSOVKv0V6TM0uXmvX6 zgQA== X-Gm-Message-State: AIkVDXKgPkZcmgCA2hkYFcVCvySPS94mp1K6DVbGUvXesfVsF1W4LUgaJQ7CqOjR/mvpbx9qtCpNQdgK9PyubA== X-Received: by 10.223.163.207 with SMTP id m15mr1760397wrb.66.1483721279356; Fri, 06 Jan 2017 08:47:59 -0800 (PST) MIME-Version: 1.0 Received: by 10.194.173.106 with HTTP; Fri, 6 Jan 2017 08:47:58 -0800 (PST) Received: by 10.194.173.106 with HTTP; Fri, 6 Jan 2017 08:47:58 -0800 (PST) In-Reply-To: References: <0D388F9E-98FA-4C1F-95FA-759C4D4731C6@gmail.com> <2A.04.04761.F9A9D585@pb1.pair.com> <2017010414120739532-pmjones88@gmail.com> Date: Fri, 6 Jan 2017 17:47:58 +0100 Message-ID: To: Paul Jones Cc: PHP Internals List Content-Type: multipart/alternative; boundary=f403045f1b4ecd433205456fc762 Subject: Re: [PHP-DEV] Re: [RFC] ServerRequest and ServerResponse objects From: ocramius@gmail.com (Marco Pivetta) --f403045f1b4ecd433205456fc762 Content-Type: text/plain; charset=UTF-8 Hi Paul, On 6 Jan 2017 3:19 p.m., "Paul Jones" wrote: Hi all, Today marks two weeks since this RFC was introduced. As I said at the start, it's the holidays, so I expect to keep the discussion period open for longer than two weeks, but I am surprised at how little discussion there has been. I find it hard to imagine that all criticisms have been raised, and that the remainder of the RFC is otherwise unobjectionable. So, if there are further questions, please let me know! As mentioned before, the fact that the RFC proposes *yet another* (XKCD 927) request/response API simply increases fragmentation within the ecosystem. This is not useful, especially now that a common interoperability interface for request and response that works quite decently and is getting traction (PSR-7) exists. Bundling the interface is no biggie, so I suggest steering away and going that way, or else you are just adding API that everyone would just need to build wasteful adapters for. There are several technical issues too: * A magic constructor that fetches data from global state: add a factory for that, leave the constructor open for modifications or new instantiation ways, or make it private. * Magic read-only properties that go against the language semantics: make 'em accessors, or do whatever you want, but don't invent new language semantics just for your own extension. * A series of non-exhaustive properties that give some "helper" API to see if it's XHR or not, violating basic SRP. Are you abstracting a request or what you want to do with the request? You can define separate utility functions for that. Yes, functions. * As per current API, I'd expect the ctor to throw an exception when used outside the web SAPI context * You use the *with* prefix for setting values, while you know exactly that *with* was used to differentiate from a mutable and a non-mutable API in the existing request abstractions: this makes things confusing again * There's no interface for these classes, and they are not marked as final, as far as I can see. This means that users will extend them (unwise choice), and with that they will have a class with reflection bits in the extension (extremely bad idea!). An interface and final are needed here. Anyway, this is just a partial review of what I got to read with a few minutes of time, yet loads of issues are evident. I am obviously defensive and biased here, but if something new is being designed for inclusion in php-src, and it has to reach millions of developers, it better be *reeeeeealli* good. The issues above are just the tip of the iceberg, and many developers obviously didn't use nor try this extension so far. IMO needs another few design iterations, and a lot more adoption, in order to become interesting. Orrrrr you provide us with a factory for an implementation of these concepts that already has adoption, traction and extremely careful design behind it. Greets, Marco Pivetta --f403045f1b4ecd433205456fc762--