Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62178 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14552 invoked from network); 15 Aug 2012 09:34:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Aug 2012 09:34:11 -0000 Authentication-Results: pb1.pair.com smtp.mail=sv_forums@fmethod.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=sv_forums@fmethod.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fmethod.com from 209.85.215.170 cause and error) X-PHP-List-Original-Sender: sv_forums@fmethod.com X-Host-Fingerprint: 209.85.215.170 mail-ey0-f170.google.com Received: from [209.85.215.170] ([209.85.215.170:38410] helo=mail-ey0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 44/F3-30529-21D6B205 for ; Wed, 15 Aug 2012 05:34:11 -0400 Received: by eaao11 with SMTP id o11so388221eaa.29 for ; Wed, 15 Aug 2012 02:34:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:from:to:cc:references:subject:date:mime-version :content-type:content-transfer-encoding:x-priority:x-msmail-priority :x-mailer:x-mimeole:x-gm-message-state; bh=NqPk1us2PO6mkv0vd5xCG1zX8+t6zikmyRrcNlh9Zg8=; b=m3SMg/9XFvtlWd1lQTD8C5WJu0glbYptCs7GtIIzPAPxdYV6FeqWplZr6YCSGMyb1O v/YzNvtKh4iO0IUTNj44RqPPL7zyhuoacCvpmUyjtcHxYrCrOIlMd7lZ2petmGl526Jf ut6npU9JAt3aowbYsEm4cq7JpgzavFkiQlX/q3VnRimym4WArp59FO+bJpoDEEUp57vd I59OPNZMbLYrtnqjMHdoUsKcPgJYwd/eUVAMuhfyOdw6yOAOZDhpLL4hfPgFLiloPCUe ztSQ7jCpekg+nj5+m0DFZqU8Uf3dtHVAKNFYBNlFJB/+qWNziS03qQ0lEAmhRpK5nh5S dXRQ== Received: by 10.14.206.201 with SMTP id l49mr20193027eeo.3.1345023248452; Wed, 15 Aug 2012 02:34:08 -0700 (PDT) Received: from pc (95-42-66-13.btc-net.bg. [95.42.66.13]) by mx.google.com with ESMTPS id z6sm2572735eeo.6.2012.08.15.02.34.06 (version=SSLv3 cipher=OTHER); Wed, 15 Aug 2012 02:34:07 -0700 (PDT) Message-ID: <7E8BEBA16BC24F65B284FA0FC48351E3@pc> To: "Nikita Popov" Cc: "Stas Malyshev" , References: <502A86AA.2030203@sugarcrm.com><502B57AE.4070801@sugarcrm.com><502B5C7F.1070708@sugarcrm.com><6D84602D0F514FA3B82C11DBAF58AA53@pc><502B5F8A.5000500@sugarcrm.com><6281E4639C7248488268ACED88B86B7D@pc><502B669E.7040702@sugarcrm.com><1583D6716BFA4BF985E795A1363F465E@pc> Date: Wed, 15 Aug 2012 12:34:04 +0300 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="ISO-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Gm-Message-State: ALoCoQlRSM3iEErwP+pEg1oEoz7wFslw/e907KONwrrgv3HCocBX8Nj7VsS4FBm0pR2Uw0caGt4A Subject: Re: [PHP-DEV] Inline typecasting / typehinting for classes and interfaces From: sv_forums@fmethod.com ("Stan Vass") > Stas already pointed out that parameter typehints allow you to define > the interface for your method. Return typehints would server a similar > purpose and as such I'd consider them useful. But "variable" typehints > don't serve any such purpose. I gave an example validating an array of Foo instances, which the current system doesn't solve. Of course PHP could extend argument typehints to describe this, but Stas *just* said he doesn't want generics and so on in PHP. All right, I don't either. I just want a clean way to describe my expectation that a variable is what it is, and assuming that all function arguments are one single instance simply doesn't match the real world out there. People iterate arrays, they pass arrays around. And they have expectations for what's inside those arrays. Stan