Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96566 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88827 invoked from network); 23 Oct 2016 23:04:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Oct 2016 23:04:20 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.169 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.192.169 mail-pf0-f169.google.com Received: from [209.85.192.169] ([209.85.192.169:34612] helo=mail-pf0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 18/43-28528-2F14D085 for ; Sun, 23 Oct 2016 19:04:18 -0400 Received: by mail-pf0-f169.google.com with SMTP id r16so86706368pfg.1 for ; Sun, 23 Oct 2016 16:04:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=J1N0xxJTjC0EGCDXok85Ibkm0l3A5hxSAgu4aHBdjbg=; b=iZPaA5UJgRjN2xjklLihhWO11LYfo1iXwkg0AmhOLXB76mWNI95ybrIuhRIGRMhg18 SDIYI0xuks9K/9wj7oTOceQXjdH6ullgoVAn6SMUlxQh27eqeZdi3q38qQy485hu0/ag IhSZcq9+DHyVqOXxtq2pRMz7sGR80IOJdRUmrINaUpscpgqENQfu3AozLSgcktEmPWcj acv9lWW7+fwPdmoPBEqmeQDWr0/pNp8XWeJuLy/4rmQDS+RX3F9Ir7dPZCq2ghhWi2hb h9Dew9qqnvZwAwPD+bgW0feMlVuwgK32XN1N5D25UAgNLkxvKHyRRYfhEShy4SscUMLY 3pnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=J1N0xxJTjC0EGCDXok85Ibkm0l3A5hxSAgu4aHBdjbg=; b=mAQcCa67IL2lah9GbXb//4KFhqwVqZ61DFeEG5/P4hjZdVOb0VVLevHNhlFK83pQ62 j1daMoVB9sNhX3rU21dxclqKS5iyyiPuezpskVOhqWKMpXML4ya/0nhBVjWkwL++KhoY cpGhIgaFsNLqyiBTW4cbCeuzlWEZCUEHmlI9rZWskS/mho/FyTr6/6Okd54keNKCulNo JvNRHi9Ng1m8Arg1YHil6BnYongM7BKA1D8EfNGjU09O33XH0nqgPLMAdGwQq28MJ5tM hYvTey2X8eWq1wgohWNtf07tLbCptyiysvF1bBMw5HIwsq/yAucPFZFhiGdUINoSEtxG R0fA== X-Gm-Message-State: ABUngvdAF2UWPSLOuYLxUrzDPh3XvoTNbT0vp2d07JUpKZ1PbS4Bpe7GNiSnRL0PcR8IzQ== X-Received: by 10.99.123.90 with SMTP id k26mr3112138pgn.153.1477263854489; Sun, 23 Oct 2016 16:04:14 -0700 (PDT) Received: from Stas-Air.local ([2602:306:ce9c:e680:1890:46a7:9aa1:a4af]) by smtp.gmail.com with ESMTPSA id k89sm19981920pfg.6.2016.10.23.16.04.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Oct 2016 16:04:13 -0700 (PDT) To: =?UTF-8?Q?Micha=c5=82_Brzuchalski?= , PHP Internals List References: Message-ID: <1e7da1db-9fc6-a3ce-9cba-b219af2dd7d4@gmail.com> Date: Sun, 23 Oct 2016 16:04:12 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC][DISCUSSION] Object type hint From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > I would like to initiate discussion for Object typehint RFC > https://wiki.php.net/rfc/object-typehint I don't see why it would be important that the variable is an object but not important which kind of an object. There's very small number of things you can do with an object without knowing the exact type. For generic functions, like serialization, there's no reason why they shouldn't be able to serialize integers or nulls or booleans. On the contrary, many objects would not be serializable. For less generic functions, like DI containers, object type is next to useless since you can't just pass any object to implement a service - it should actually implement the required service. So adding "object" does not add real specificity to it. > This feature is developed to provide missing functionality which is needed > and quite easy to introduce. > There are many people which I've talked about the benefits of this > functionality. > > For those who doesn't like the idea and think they won't need neither use > it rather than just saying 'no' they > please say why other people who want to use that parameter type are wrong, > for wanting to do that. They probably think more "strictness" and more checks means better code. It is usually not true per se. E.g. in the RFC examples the type does not seem to be serving a good purpose - it's either wrong (like in the case of json_decode - it won't always return an object), or nonspecific - like in factory, very rarely one has a factory returning just arbitrary objects, no matter what they are. -- Stas Malyshev smalyshev@gmail.com