Req #66855 [Csd]: There is no NotImplementedException

From: Date: Tue, 25 Mar 2014 16:13:29 +0000
Subject: Req #66855 [Csd]: There is no NotImplementedException
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-184884@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66855&edit=1

 ID:                 66855
 User updated by:    eldmannen+php at gmail dot com
 Reported by:        eldmannen+php at gmail dot com
 Summary:            There is no NotImplementedException
 Status:             Closed
 Type:               Feature/Change Request
 Package:            SPL related
 PHP Version:        Irrelevant
 Assigned To:        levim
 Block user comment: N
 Private report:     N

 New Comment:

Levim, no it is not.

Maybe the person implementing the interface haven't written that method yet.
Not all methods in a interface is widely used, some is rarely used.

Maybe some implementations would be very tricky to write, so until further it throw NotImplemented.

Maybe for some reason it is not feasible to support that method given some circumstances and
limitations.

NotImplemented is sane and it is supported in multiple other languages and for a good reason. Having
to write your own seems silly, as its not project-specific, and hence something that would be much
re-used and benefit everyone.


Previous Comments:
------------------------------------------------------------------------
[2014-03-25 13:47:34] levim@php.net

Just make your own and throw it. I'm in favor of revamping the SPL structures and exceptions
but even then I wouldn't include NotImplementedException; it's a sign that your interface
or parent class isn't designed properly.

------------------------------------------------------------------------
[2014-03-09 17:09:45] eldmannen+php at gmail dot com

RuntimeException can be pretty much anything. It is very disambigous.

While NotImplementedException is very specific and explicitly conveys that this method is not
implemented.

If you get a RuntimeException you have no idea what is going on or why you're getting it.

If you get a NotImplementedException then you know exactly why you got it.

It is also available in many other languages;
Python - http://docs.python.org/2/library/exceptions.html#exceptions.NotImplementedError
Ruby - http://www.ruby-doc.org/core-1.9.3/NotImplementedError.html
.NET Framework - http://msdn.microsoft.com/en-us/library/system.notimplementedexception%28v=vs.110%29.aspx
Java - http://docs.oracle.com/javase/7/docs/api/java/lang/UnsupportedOperationException.html

------------------------------------------------------------------------
[2014-03-09 16:43:55] phpmpan at mpan dot pl

What's the purpose of such exception? What's its advantage over pure
\RuntimeException?

------------------------------------------------------------------------
[2014-03-08 18:00:17] eldmannen+php at gmail dot com

Description:
------------
There is no NotImplementedException.
Please add a NotImplementedException.



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=66855&edit=1


Thread (8 messages)

« previous php.bugs (#184884) next »