Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98499 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 25111 invoked from network); 12 Mar 2017 09:36:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Mar 2017 09:36:25 -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.169 as permitted sender) X-PHP-List-Original-Sender: michael.vostrikov@gmail.com X-Host-Fingerprint: 209.85.161.169 mail-yw0-f169.google.com Received: from [209.85.161.169] ([209.85.161.169:36382] helo=mail-yw0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id ED/09-38004-79615C85 for ; Sun, 12 Mar 2017 04:36:24 -0500 Received: by mail-yw0-f169.google.com with SMTP id o4so45089289ywd.3 for ; Sun, 12 Mar 2017 01:36:23 -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:cc; bh=87GOlsVxZ9fi/s2TAMGz4yUkrTSUFn4lIc0yo1+OXzk=; b=ho7QYIVOBSQ22caCHWY7cWhaoLwqx2fqL50Uk2aWCCAHrrqZXEweRP2YjPc7w8iTFp NfH5lveERD+VYmvzxSzEOUV6rseYC1a5ktNwVwZrkvmLm2KLqaXR5LV3kQJAgEQA6R9b wGZzhcTgcfR84dppfaaSMGNTHHYscrv5TJqzoj6hs+pCi3a4L4AL55e2FaOOsNcKa6Rp ej9Ce4VBLI7pI8Fb28mCbf5EKsmRv1aYIJjkH7PGp1+8e/LwJWCzLydKq4QP3xxQn6+R A0S7TZI3EfmPgPVh3D0OyziSBPG8AiH/2J1dxpG2N2f6HrfWJ3ZsdMwZqQKj1cT83soL bn4A== 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:cc; bh=87GOlsVxZ9fi/s2TAMGz4yUkrTSUFn4lIc0yo1+OXzk=; b=sySY99JnuUpmS2dVSfXMh51BPUSmcudc717D/bywdAPUD7Q3hB2M4BZAzFg7pooO9d mg+lOLDMfbvnnAJ6rpqM0m2J0ZMf+K1LixZNnA4EMjlMZbe3DGs6gLHdPUEOECp5A5+Y LMIa6kyXxNlYiJzJ3wH/8+H/5iP+Y1WyX8HJkm03NKJU2pIQlo6YphMUuje5cnGPK0Ri Z6Nb7pzc1TG444UE6XKHnpz3fKak7Cm3ke8Jw4Wzl9UXdC5d28kv+G89D/p+xhQlamt2 Ct7udLpApbszpOhFr/N1VsvSJnT0mNicg0qaI2nMmHVlYAk2rxai8jJkFS0ay6qwQWIa oJUA== X-Gm-Message-State: AMke39mBUrwO7snQzRn7KkgsBBsfLM7vHCibaHXQa4z+8RNhNQofJ8q6B/IceDCM7Q9ELmd1H+xhcY8qrQzaYw== X-Received: by 10.13.225.142 with SMTP id k136mr13803758ywe.178.1489311380103; Sun, 12 Mar 2017 01:36:20 -0800 (PST) MIME-Version: 1.0 Received: by 10.13.224.196 with HTTP; Sun, 12 Mar 2017 01:36:19 -0800 (PST) In-Reply-To: References: Date: Sun, 12 Mar 2017 14:36:19 +0500 Message-ID: Cc: PHP Internals Content-Type: multipart/alternative; boundary=94eb2c0612c0c56b7f054a855368 Subject: Re: [PHP-DEV] Type variants From: michael.vostrikov@gmail.com (Michael Vostrikov) --94eb2c0612c0c56b7f054a855368 Content-Type: text/plain; charset=UTF-8 2017-03-12 13:58 GMT+05:00 Sherif Ramadan : > I think you're trying desperately to find a problem that is fitting of the proposal Checks in business logic are popular task. > If the problem you're trying to solve pertains to object state that I have no idea how this proposal hopes to achieve that. You can readily control object state in PHP without the need for declarative types (e.g. magic getters/setters) I described in first message the way how the proposal can help with this. There is no magic getters/setters there. > Not seeing how this proposal improves or even achieves such a thing. Now we need to write in business logic the following: function checkout(Order $order) { if (count($order->products) > 0) { throw new SomeException1(); } if ($order->date === null) { throw new SomeException2(); } if ($order->address === null) { throw new SomeException3(); } // checkout steps ... someActionWithOrderForCheckout($order); ... } function someActionWithOrderForCheckout(Order $order) { if (count($order->products) > 0) { ... } if () ... } Of course, we can move all checks to some function like 'ensureOrderIsReadyForCheckout()' and call it everywhere manually. But this is the same as call is_integer() manually instead of type hinting. --94eb2c0612c0c56b7f054a855368--