Re: Re: Exceptions instead of Fatal Error when calling non existent method?
| From: | Fredrik Holmström | Date: | Mon, 31 Dec 2007 12:09:57 +0000 |
| Subject: | Re: Re: Exceptions instead of Fatal Error when calling non existent method? | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-34295@lists.php.net to get a copy of this message | ||
> 2007/12/31, Mikko Koppanen
> Calling methods without knowing that they exist sounds like a hack to me. How about using
> abstract classes or interfaces?
If you look at, for example, python - calling methods that don't
*know* exists is common practice, it's not a hack from my point of
view. It's just easier to ask forgiveness then permission, to quote
Hopper.
I never understood the direction PHP is heading with type hinting,
static binding (SPL-Types?), etc. While I don't directly oppose it I
don't see any reason for it. I just thought that adding some type of
ability to handle unknown method calls (without forcing *every* class
to implement __call() in a specific way) would be a nice way for those
of us that want to continue to use php as the dynamic, duck-typed
language we learned. Maybe it will fall on deaf ears, but I thought it
was worth a chance and at least propose it here on internals.
Regards, Fredrik.