Re: Type hinting - Request for Discussion
| From: | Richard Lynch | Date: | Tue, 21 Jul 2009 16:04:51 +0000 |
| Subject: | Re: Type hinting - Request for Discussion | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-45057@lists.php.net to get a copy of this message | ||
On Fri, July 10, 2009 10:50 am, Alban wrote:
> Le Fri, 10 Jul 2009 16:16:51 +0100, Alain Williams a écrit :
>
>> On Fri, Jul 10, 2009 at 10:57:22AM -0400, Alban wrote:
>>> Le Fri, 10 Jul 2009 14:23:24 +0100, Alain Williams a écrit :
>>>
>>> > On Fri, Jul 10, 2009 at 08:45:55AM -0400, Alban wrote:
>>> And Exception is better than an Error because this give one chance
>>> to
>>> programmer for resolving the problem before program be halted.
>>
>> Not everyone understands try/catch. Perhaps a user supplied
>> function_argument_error() could be called if not in a try/catch
>> block.
>
> If user not understand try/catch, he don't use it and the exception,
> not
> catched, generate an error.
I think anybody who is coding with strict/weak/contract
type-enforcement/casting is going to understand
try/catch/Exceptions...
Granted, the people using that code and maybe stuck maintaining it
could be in for a steep learning curve.
But I don't think an Exception being thrown will be problematic for
the original coder using this type-hinting stuff.
PS
The contract stuff looks kind of cool, but seems too unwieldy for
pre-parsers/IDEs/lint type tools, so I'd have to vote "nay" on it, if
my svn access to docs gives me a vote...
--
Some people ask for gifts here.
I just want you to buy an Indie CD for yourself:
http://cdbaby.com/search/from/lynch