Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98488 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 2578 invoked from network); 12 Mar 2017 06:38:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Mar 2017 06:38:08 -0000 Authentication-Results: pb1.pair.com header.from=michael.vostrikov@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=michael.vostrikov@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.173 as permitted sender) X-PHP-List-Original-Sender: michael.vostrikov@gmail.com X-Host-Fingerprint: 209.85.161.173 mail-yw0-f173.google.com Received: from [209.85.161.173] ([209.85.161.173:36589] helo=mail-yw0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 45/55-38004-FCCE4C85 for ; Sun, 12 Mar 2017 01:38:08 -0500 Received: by mail-yw0-f173.google.com with SMTP id o4so44257325ywd.3 for ; Sat, 11 Mar 2017 22:38:07 -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; bh=eTCp7sw4+OxKEz1Yxbka9jCB1Y8Qop0Wjzb7ZOWdKcE=; b=Uk3w4MO7U9EdsbyxUU7MniYwuGWBVfyJhntGZqckWdZFm4ZGJuPBe71s00IMl8ZN6H JeeD+wrhGfEciQKvggz0XOY5kJxd4a6ML7XF5ye21zbguB2vulRMpte6YHedo017RTyT 3l67YApCX4ZRxTkcxA2OhX9m7VsBLrWVzOTScaazk44uRjK5VB5bel1IcNT5gKB+q131 Co3CKwCA2vlQ0aIqBdA/A9qq5ohoMzpnDCggyLLhq5ORM9BI+vLXsQK5/ivMln3wpp8F lFWqaq3kPNH0Cngj/6Onwcd8pq+Z1jGeY7NxcCDzUVJZZZaAx4aFeFZb4AgGTFAFRSat NgEg== 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; bh=eTCp7sw4+OxKEz1Yxbka9jCB1Y8Qop0Wjzb7ZOWdKcE=; b=udSbzouugX6mYj/Bl3dbj/url3bFazY06+S5QfpOjPR3YSqannqRtvdFvvVLgnysLh C9W9bIbBzgUfWMBPmvAkDynl6CCclbJeVQEFTaS106k3kbh1Qf46pz3vmw9DengSvaNw By1dCiZz9rZQFc4mMmtTfL5I48Ga0TZDzgpN6mf6JMdcwWe7IIdhCGoZebHp9I8VSzUi MBL3RrIl11YZ7kzkwqJegT9XsdLjIlWhENdub7UEibEIHi3EME5PFTxu4RxCrxQu08TG ifYFyWWie2fxRwVO46EQjuKO008vWsVrFrAvk99FPhl4NqppMc1wyPeglDgkeoavYrYj vIVw== X-Gm-Message-State: AMke39nBBqRFCgu+SGoydaPGHRgji5eHRQUwhz/1pjous9h9WsrRONrP1ZLfBebR0KVS4RWmxpccq73A6/onMQ== X-Received: by 10.129.116.213 with SMTP id p204mr14097985ywc.151.1489300684431; Sat, 11 Mar 2017 22:38:04 -0800 (PST) MIME-Version: 1.0 Received: by 10.13.224.196 with HTTP; Sat, 11 Mar 2017 22:38:04 -0800 (PST) In-Reply-To: References: Date: Sun, 12 Mar 2017 11:38:04 +0500 Message-ID: To: PHP Internals Content-Type: multipart/alternative; boundary=001a1147f5c04269ed054a82d65d Subject: Re: [PHP-DEV] Type variants From: michael.vostrikov@gmail.com (Michael Vostrikov) --001a1147f5c04269ed054a82d65d Content-Type: text/plain; charset=UTF-8 > Example with Rectangle and Square IMO is an example of bad naming in this case. I used this example because this is known problem of inheritance. Type variants solve this problem. Square is a particular case (variant) of Rectangle. > PHP already has horizontal inheritance. They're called traits. How is this an improvement in anyway? Trait is just reusable implementation. I suggest type matching. This is extension of type hinting. It can be used in all cases where we need to check if an object matches some criterias before continue operation. It is a kind of defensive programming and a replacement for many 'if-throw' constructions. --001a1147f5c04269ed054a82d65d--