Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62166 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90888 invoked from network); 15 Aug 2012 08:06:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Aug 2012 08:06:39 -0000 Authentication-Results: pb1.pair.com header.from=sv_forums@fmethod.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=sv_forums@fmethod.com; spf=permerror; 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:64767] helo=mail-ey0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 27/A2-06007-E885B205 for ; Wed, 15 Aug 2012 04:06:39 -0400 Received: by eaao11 with SMTP id o11so366790eaa.29 for ; Wed, 15 Aug 2012 01:06:34 -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=EwANqN7G3hwbltlP3QrCoUgzFfoEDQF+Bd+KqfUHxfQ=; b=Gw0F55Aq2siPzhbOf0RRSuE0nPQTMuoKBSWvhfTc05JxeT21KfZvL+eWot6cP6aBin VeRrxWksNltWqI6un0f3ztQfG3G4UYrwY9Fd6HkUHLkD4HdXSNACyWgEtVdY6K9SvJEA w/xCHnQCDtQ6FAmVjE/JEnVtt1gnpo+5ce7dhHXyrxjJg4yncYJdiBMghRicJOAw9ONl 8iSDnp0O7cXdU4JVxQwzjWSPgBH2or/nqDxz0wJJBOQRMjaH/DRulahWcfcNgam+2yK2 9a5ZzRjHZzM7Rqre7sqmb1xfZv1c8dRs60Pdx6j4Kg7UjPEEC90To6tdP6igR9fWTKWj xO9w== Received: by 10.14.202.66 with SMTP id c42mr23401991eeo.35.1345017994431; Wed, 15 Aug 2012 01:06:34 -0700 (PDT) Received: from pc (95-42-66-13.btc-net.bg. [95.42.66.13]) by mx.google.com with ESMTPS id c6sm1989421eep.7.2012.08.15.01.06.32 (version=SSLv3 cipher=OTHER); Wed, 15 Aug 2012 01:06:33 -0700 (PDT) Message-ID: To: "Stas Malyshev" , "Anthony Ferrara" Cc: "Levi Morrison" , References: <502A86AA.2030203@sugarcrm.com> Date: Wed, 15 Aug 2012 11:06:30 +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: ALoCoQkZEPqkInNYppxtSujYVLS64gJ4CiYQeuOAkxCi1Bam2PQhul9U1tZnRVRB6FHMBBkbfsWu Subject: Re: [PHP-DEV] Inline typecasting / typehinting for classes and interfaces From: sv_forums@fmethod.com ("Stan Vass") I'd like to also ask people to read what the intended effect of the proposal is instead of going into abstract discussions about how casting one class to another doesn't make sense (this is not what's being proposed). Just like PHP typehints look like static typing but *aren't*, the same way the fact this looks like a static cast *doesn't* make it so. A dynamic language can't have static casts, and I'd think this is obvious to everybody. Instead, I'm adapting the principle so it fits with existing PHP behaviors and patterns. Syntax which looks like static typing is fine by me as well. Examples: ClassName $foo = expression(); foreach ($list as InterfaceName $item) { ... } etc. The only operation done here is validating the variable is a valid instance of this type. No transformation is happening. Stan