On 13.04.22 15:36, Craig Francis wrote:
On Mon, 11 Apr 2022 at 20:08, Andreas Leathley <a.leath...@gmx.net> wrote:
You are taking parts of the documentation out of context, and omitting
the start of the whole "Converting to string" section:
"A value can be converted to a string using the (string) cast or the
strval() function. String conversion is automatically done in the
scope
of an expression where a string is needed. This happens when using the
echo or print functions, or when a variable is compared to a
string. The
sections on Types and Type Juggling will make the following clearer."
I'm sorry, I've read this several times now, and I'm not sure what
this adds. My RFC simply quotes the paragraphs that explain how null
is coerced (other than the small abbreviation for booleans, those
paragraphs are included in their entirety), I don't think it needs any
more context than that, it's not like I'm mis-representing how
coercion works (and is used) in PHP.
Mentioning the documentation as a reason to be "consistent" (which comes
up again and again in your arguments with this RFC) just seems like a
bogus reason to me. It is nitpicking about specific sentences in the
documentation without refering to the surrounding context. It would be
nicer to argue according to real technical arguments instead of
arguments about sentences taken out of context in the documentation.
You can see NULL however you like, but most developers do not share
that view. NULL has been passed to these functions, since, well,
forever; and changing code to manually convert NULL to the relevant
type is incredibly time consuming, and of questionable value (e.g.
when developers simply add strval() everywhere).
"Most developers do not share that view". I find statements such as
these as a tall order - did you interview the majority of developers
around the world? Are you suggesting you are talking as a representative
of a large population of PHP developers? How do you think you got such a
role? I would prefer some humility and not assume you are an elected
leader of an underrepresented group of developers and even knowing the
intention behind their code.
"NULL has been passed to these functions, since, well, forever" - this
also goes for wrong values being passed to functions since forever
leading to security issues and bugs. That is the whole point of
developing a language: Reducing the surface for bugs, improving parts of
it where a lot of bugs have happened historically and not making the
same mistakes as other languages (and learning from the good parts of
other languages). More people writing code in a certain way does not
make that code better or safer.