Ok, last email then I swear I'll drop the issue and let you big dogs decide
on a solution :)

You say you are opposed to allowing null for type hinted values. Yet then
you say you would agree to optional type hinted params (which could only
default to a null value), so as a result, you really aren't opposed to
allowing null for type hinted values. And as such, using [MyClass] to define
the class hint to allow null shouldn't be an issue for you. If you don't
want to make the class hint null, then don't add the [] or whatever is
decided upon, but the people that don't follow your particular OOP
guidelines can use [] to make null an allowable value.

A perfect example of when null MAY make sense:

Function Equals([ZObject] $objA, [ZObject] $objB) {}

if ($a->Equals($b, $c))

Where this has more of an impact is when you are not the primary user of
your library. For instance, I am working on a php extension that emulates a
major portion of the .net framework library. Now luckily, internally, I can
define that exact behavior for my classes since I can define the arguments
to allow_null. But I think it would be pretty funky for the C classes to
allow functionality that the PHP userland classes don't.

I love good discussion!

Bob




-----Original Message-----
From: Marcus Boerger [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 19, 2004 3:26 PM
To: Robert Silva
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DEV] Type hints with null default values

Hello Robert,

Tuesday, October 19, 2004, 11:33:29 PM, you wrote:

> Am I just being a goofball seeing a distinction between allowing a class
> hint to accept null vs. it being an optional parameter?

> Both Todd's and Marcus' replies seem to indicate otherwise.

I didn't say anything else. I said we discussed the difference already
and i don't see any sense in allowing null for typehinted values. If
at all we change anything i would only agree to make typehinted params
optional. And i would agree to the proposed use of [] if that is feasible.
I hope this made my position clear.

regards
marcus

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

Reply via email to