Re: type hinting
| From: | Sam Barrow | Date: | Wed, 06 Feb 2008 00:12:14 +0000 |
| Subject: | Re: type hinting | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-35214@lists.php.net to get a copy of this message | ||
On Wed, 2008-02-06 at 00:27 +0100, Markus Fischer wrote:
> Tomi Kaistila wrote:
> >> No one seems to have answered my point that actually relying on type
> >> juggling for anything other than string concatenation is asking for a
> >> problem.
> > Probably because there isn't a way to answer that point. Anyone who does would
> > be laughed out of the barn. Like I told Sam just few minutes ago, the fact is
> > that no matter how wonderful PHP's juggling is, there is still a reason why
> > we have different data types. If it was all the same we wouldn't need
> > integer, float, et cetera. But we do have them and we do need them.
> >
> > The whole objection against this feature was never about the technical merits
> > of it. It was just simply about some people saying "I don't like it" and
> > thus
> > concluding that it should not be added.
>
> Well spoken.
>
> Technically, I'm playing around in my spare time with many things no one ever
> needs, so also create another component library from scratch etc. but right
> from the start with Sam's patch and all I gotta say is: damn, I love it.
>
> It saves my day because it saves me time. It helped me detecting errors right
> ahead before they would creep up sometimes later without having to do much
> type checking myself, just using the scalar hint just helped a lot.
Right. This hint will allow us to follow the type juggling rules, and
just as important, it helps cover the full spectrum of variable types.
With scalar and resource, there is a type hint for every type, whereas
the current implementation is blatantly incomplete.
> I'm a documentation freak and it also speeds up my PHPDOC documentation
> process, I trimmed my editor already to understand the scalar hints and
> pre-fill PHPDOC accordingly.
>
> Hope this doesn't sound like marketing blabla. I'm just so happy with it.
>
> - Markus
>