Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63471 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93386 invoked from network); 16 Oct 2012 15:41:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Oct 2012 15:41:25 -0000 Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lerdorf.com from 209.85.216.170 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 209.85.216.170 mail-qc0-f170.google.com Received: from [209.85.216.170] ([209.85.216.170:41760] helo=mail-qc0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0B/E5-62581-4208D705 for ; Tue, 16 Oct 2012 11:41:25 -0400 Received: by mail-qc0-f170.google.com with SMTP id d42so5537732qca.29 for ; Tue, 16 Oct 2012 08:41:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding:x-gm-message-state; bh=gD5enWcpipkCyV5pRG4k0McOqqOjAOJO+1aQX0Yoy68=; b=jEnDUPjpRO4a61hswQzbvN2eKkXp5lWIp9FpTLVU5R6QIOBMs5xz/hho+q+sylwqxX 8Jzg8VGjmFgCqF4OhRD0iv3iAVPN6Uhe99VlrBcKnaLaxHFtWCHbN7txqcKrVeG1ert5 NkM5K5co+fuZRgpV5xOtw9pBmfdJBzU7/yC8DlEvezLLgDvvLnewdLx/o8A8MVGWwVXy rvi1KCK0aJEp2Wc6HwPgBn+mrtoyNNtAD5INjAH8r+L9ZGBw7ymw9CIykuQyVAZMDK0M Q5aHtmrywa8sbTJ9PDPvVvQrXwfZG1yqUjAOeUdE8Tw6/B6VlI2Fl9PZIhrQar3c0UZW j1Yw== Received: by 10.224.111.16 with SMTP id q16mr26780512qap.19.1350402082109; Tue, 16 Oct 2012 08:41:22 -0700 (PDT) Received: from [192.168.200.148] (c-50-131-44-225.hsd1.ca.comcast.net. [50.131.44.225]) by mx.google.com with ESMTPS id jt10sm17162196qeb.4.2012.10.16.08.41.20 (version=SSLv3 cipher=OTHER); Tue, 16 Oct 2012 08:41:21 -0700 (PDT) Message-ID: <507D801E.7070508@lerdorf.com> Date: Tue, 16 Oct 2012 08:41:18 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120912 Thunderbird/15.0.1 MIME-Version: 1.0 To: Amaury Bouchard CC: Stas Malyshev , Levi Morrison , Clint Priest , "internals@lists.php.net" , "Nikita Popov (nikita.ppv@gmail.com)" References: <9570D903A3BECE4092E924C2985CE485612B6434@MBX202.domain.local> <507D133A.4040701@sugarcrm.com> In-Reply-To: X-Enigmail-Version: 1.4.4 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQm6H0CsLwjfO37p+42H/WObSwgDcg92z8+58iVc8GpywRZDXP2fUlrSRw5vqdXInAu58ydk Subject: Re: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 : Typehints / Accessor Syntax From: rasmus@lerdorf.com (Rasmus Lerdorf) On 10/16/2012 02:51 AM, Amaury Bouchard wrote: > 2012/10/16 Stas Malyshev > >>>> public DateTime $date; >>> >>> This is *real* progress, even if under the hood all it does is wrap >> >> I think it's a movement in wrong direction. Again, it is an attempt to >> make PHP a strongly typed language, which would not work well in a >> dynamic language like PHP, for reasons that were amply explained in 9000 >> discussions we had on this topic before. > > > Not necessarily strongly typed. (sorry to land on this topic afterwards) > As I see PHP, it's a language that can be used as an informal scripting > language, but also as a rock-solid modern tool. > Type hinting in parameters is a really good thing, and it doesn't > transformed PHP in a strongly typed language. > Doing the same for object properties (always optional) could be very useful. The rule in PHP for any sort of type hinting is that it is only done for non-coercable types. In cases where there is simply no way to recover from passing the wrong type, it is good to catch it as early as possible. Extending this to also cover scalar coercable types would be disastrous for the entire ecosystem and would completely change PHP. And the fact that it is "optional" means absolutely nothing because once some piece of your system has "optionally" decided to use it you don't have the option not to abide by it, and it certainly isn't a hint, it is a strong type. You will end up casting every call to everything all the time just to be safe. -Rasmus