From: Damien Tournoud [mailto:d...@damz.org], Sent: Friday, February 27, 2015 
4:54 PM

> Hi Christian,
>
> On Fri, Feb 27, 2015 at 3:38 PM, Christian Stoller <stol...@leonex.de> wrote:
> It is not a bug. FALSE as a return value of substr() is the identificator
> for an error (e.g. invalid arguments), as it is stated in the documentation:
> [...]
>
> "It is documented that way" and "it is not a bug" are two very different 
> things.
>

That’s not true. Quoting Wikipedia "A software bug is an error, flaw,
failure, or fault in a computer program or system that causes it 
to produce an incorrect or unexpected result, or to behave in 
unintended ways." [1]

In this case FALSE is an expected result and it is intended. And as
I said other languages are going the same way.

>
> In that case, the semantics of `substr()` are just wrong. It makes 
> a lot more sense for a sub-string function > to silently allow
> reading before the beginning and past the end > of a string.

Just because it makes more sense for you, it does not imply that
it makes more sense for everybody. In my opinion it makes sense to
return an "error code" if a function is called with invalid
arguments.

> This behavior is unpredictable, and as a consequence using `substr()` 
> properly would require a lot of painful and unnecessary up-front 
> checks. 

I agree with you, here. With the coercive patch this will lead to
More checks. But that's different from "it is a bug" ;-)

  1: http://en.wikipedia.org/wiki/Software_bug

Reply via email to