Re: Why WP_Error Sucks

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Why WP_Error Sucks

Ian Dunn
Resurrecting this old topic because I came across the following posts
this morning, which offer an interesting back-and-forth between Spolsky
and Ned Batchelder.

http://nedbatchelder.com/text/exceptions-vs-status.html
http://www.joelonsoftware.com/items/2003/10/15.html
http://nedbatchelder.com/text/exceptions-in-the-rainforest.html

Michael D Adams wrote:
>/Joel Spolsky's opinion: />/http://www.joelonsoftware.com/items/2003/10/13.html (Exceptions are />/worse than GOTOs) /


_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|

Re: Why WP_Error Sucks

Jacob Santos-3
Wow. This is a really old topic. The WTF of using resources over a decade
old. I wonder if Joel has the same opinion a decade later. Really it
doesn't matter what their opinions are.

Exceptions are essentially just taking the return status out of the manual
implementation and putting it into the language. So instead of returning
some status code that the programmer has to manually lookup and take some
action. You create an exception and throw that, which returns the exception
from the function. The advantage is that you can use additional language
features to provide a single place for cleanup.

Now technically, if you are talking about Java or C++, you are looking at
traps and lower level instructions when throwing exceptions, but I doubt
PHP works that way. Exceptions are just prettier status codes. Anyone who
tells you otherwise doesn't know what they are talking about or being
pedantic, but you can safely ignore this person as they lack the
imagination to understand what exceptions are actually doing.

On Sat, Nov 14, 2015 at 1:28 PM, Ian Dunn <[hidden email]> wrote:

> Resurrecting this old topic because I came across the following posts this
> morning, which offer an interesting back-and-forth between Spolsky and Ned
> Batchelder.
>
> http://nedbatchelder.com/text/exceptions-vs-status.html
> http://www.joelonsoftware.com/items/2003/10/15.html
> http://nedbatchelder.com/text/exceptions-in-the-rainforest.html
>
> Michael D Adams wrote:
>
>> /Joel Spolsky's opinion: />/
>> http://www.joelonsoftware.com/items/2003/10/13.html (Exceptions are
>> />/worse than GOTOs) /
>>
>
>
> _______________________________________________
> wp-hackers mailing list
> [hidden email]
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers