Re: Inline typecasting / typehinting for classes and interfaces

From: Date: Tue, 14 Aug 2012 15:29:18 +0000
Subject: Re: Inline typecasting / typehinting for classes and interfaces
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-62144@lists.php.net to get a copy of this message
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.
What you want is option 4 under my alternative syntaxes section :) I'm ok with syntax 4, in fact, the more I think about it, the more I prefer that one (the one you want). I don't mind the syntax as much, I want the feature. Stan

« previous php.internals (#62144) next »