On Thu, Jan 03, 2008 at 10:13:22PM -0000, Amir Abiri wrote:

> So the bottom line is that it seems to me that what would be really useful is 
> not strict type
> hinting, but more like "Juggling hinting". i.e differentiate between an "OK" 
> type juggle and a "bad"
> type juggle. Silently perform the first, while emit a small notice or warning 
> for the later.

+1

But silently perform the juggle on the value when it enters the function, so it 
does not
need to be done many times again:

function SumToN(int $n)
{
    for($tot = 0; $n > 0; $n--)
        $tot += $n;
    return $n;
}

$total = SumToN("10");    // Perform check and then silent juggle
$total = SumToN(10);      // Perform check but juggle not needed
$total = SumToN("ten");   // Perform check and emit an error (somehow)

The error is better emitted at the point of function call rather than having
to put a check within SumToN()

-- 
Alain Williams
Linux Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer.
+44 (0) 787 668 0256  http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: 
http://www.phcomp.co.uk/contact.php
Chairman of UKUUG: http://www.ukuug.org/
#include <std_disclaimer.h>

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to