Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63499 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24163 invoked from network); 17 Oct 2012 11:17:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Oct 2012 11:17:37 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.170 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.217.170 mail-lb0-f170.google.com Received: from [209.85.217.170] ([209.85.217.170:57867] helo=mail-lb0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F7/F8-64689-0D39E705 for ; Wed, 17 Oct 2012 07:17:37 -0400 Received: by mail-lb0-f170.google.com with SMTP id gm13so5115851lbb.29 for ; Wed, 17 Oct 2012 04:17:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=wuAoAC9WUeUbAz3sYn8qMMJpcBDCJr4PSvEIeM6dW5Y=; b=Ctp8p6UmZfZuyJtDzTFvV4NL4VZBqUzPPkJ9wH0YLTnmG6HjM4zRSsCxcxVJAvLVRI kmtzNHHJNlOk0DA40cJ2zqwb6NryZAHDhbNdW0gOhRp19B6inTuwFsv2nnJkcxL/L+Ig N9bKmR2E9GHadXRAGVGk5KFr+nh9lqav0gvPO2UsMJ7i0MMT9Dc9nm7SqY4ejU99zQiz NnA1/jxYbMQ/cZbB0SjVU3WbaRKcfi+E5+TaH3q1KHezhPUNuTJgpMgQUAb9yN8fZCcJ pWHB8XYGevK+hyH9G+yUEEesPrNhTwC9xgEnqQp6o4FWklbHggoQqXxsRaBauvyB599p LT6Q== MIME-Version: 1.0 Received: by 10.112.46.105 with SMTP id u9mr6586523lbm.67.1350472652711; Wed, 17 Oct 2012 04:17:32 -0700 (PDT) Received: by 10.112.83.100 with HTTP; Wed, 17 Oct 2012 04:17:32 -0700 (PDT) In-Reply-To: <507E918E.6090206@sugarcrm.com> References: <9570D903A3BECE4092E924C2985CE485612B6434@MBX202.domain.local> <507D133A.4040701@sugarcrm.com> <507D2FB3.3030806@sugarcrm.com> <507D3D29.9070709@sugarcrm.com> <507E918E.6090206@sugarcrm.com> Date: Wed, 17 Oct 2012 13:17:32 +0200 Message-ID: To: Stas Malyshev Cc: Amaury Bouchard , Levi Morrison , Clint Priest , "internals@lists.php.net" Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 : Typehints / Accessor Syntax From: nikita.ppv@gmail.com (Nikita Popov) On Wed, Oct 17, 2012 at 1:07 PM, Stas Malyshev wrote: >> I see this argument crop up with every typehint discussion and just >> don't understand it at all. Why would you want to check the variable >> type everywhere? You just assign it and if it doesn't work, then you >> get an error. Just like it should be. I mean, do you seriously check > > No, you don't get an error. You'd get an error in compiled language. In > dynamic language, your client gets an error when his site is launched > and instead of happy launch his users get white screens. To avoid that, > you'd need to add checks - or just ship it as is and hope your unit > tests were as good as you hoped they are (which they never are). Still don't quite understand it. If the type check fails, there is a high probability that either a) there will be an error lateron, so you get the whitescreen anyways, just with worse debugging information or b) something will work incorrectly in the following code, thus making the application behave incorrectly (which is arguably worse than giving a WSOD as that at least makes the issue obvious).