Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62143 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 97330 invoked from network); 14 Aug 2012 13:51:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Aug 2012 13:51:24 -0000 Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.42 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.215.42 mail-lpp01m010-f42.google.com Received: from [209.85.215.42] ([209.85.215.42:57292] helo=mail-lpp01m010-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F2/58-00812-BD75A205 for ; Tue, 14 Aug 2012 09:51:24 -0400 Received: by lahl5 with SMTP id l5so221445lah.29 for ; Tue, 14 Aug 2012 06:51:20 -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=rf4S3Ax7MeMd+/ThZaMYD0n/GX8vKSXN+KWEtXYdS4s=; b=wmTZ21gQ2/yhw4tMz0NJph4O3Sg9CsSjaiRn2WVp+FjBe3V9tbdQXfY9z9K6u8sOs4 340uEApBRptrs/Fm9SQNdl9EPLY6+eMNVMRNOkITGXAVxgKKEhyJVLYgFhAnLvRlSC8W 5G+MuaCuMAI/Iq5L5jAbhXLRmjCD1TEJ5OiyhLkp9aui0YG8Gj1h1MC4hXYYyo0zzEYI duyluJggwFyAh882iTIDPFWxZs5Suyy+t2ka6wXfDTiWhuK/I/nrLv2WQQoJMTcd6uzr 45Y3tcZYyoczGOP+4+t6K72w06pLzZhrhuleWoA84jeOIjerq/cfCBnuPXjGndLuRqss 57MA== MIME-Version: 1.0 Received: by 10.152.144.163 with SMTP id sn3mr15965844lab.37.1344952280593; Tue, 14 Aug 2012 06:51:20 -0700 (PDT) Received: by 10.112.89.174 with HTTP; Tue, 14 Aug 2012 06:51:20 -0700 (PDT) In-Reply-To: References: Date: Tue, 14 Aug 2012 07:51:20 -0600 Message-ID: To: Stan Vass Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Inline typecasting / typehinting for classes and interfaces From: morrison.levi@gmail.com (Levi Morrison) On Tue, Aug 14, 2012 at 1:46 AM, Stan Vass wrote: > I've felt the need for this for some time. > > Proposed syntax: > ------------------------- > > $x = (InterfaceName) $container->service; I'm against this. Let's be honest, how different is this that an optionally static type? InterfaceName $x = $container->service; To be clear, I WANT optionally static typing. For the most part, type-hinting in class methods solves the static typing needs, but if we were able to declare a class member to be a certain type that would be another significant improvement. I have a proposal in the works, but I don't want to hijack your thread. To sum up: I think we need something LIKE what you are proposing, but I'm against this particular proposal.