First, let me say that I have voted against the current scalar types RFC.
Please do not let that color your evaluation of the rest of this message ...

I want to go on record (for the n-th time) as being unhappy about any
proposal that forces me to use php.ini. IMHO if it doesn't work with `$ php
-n` then it's not a solution, it's a hack. Yes, I understand that opcodes
can't be removed (perf, yay!) without knowing ahead of time from php.ini.
But the opcode removal difficulty should not be understood as a "well we
just have to do it this way," situation. Instead it ought to serve as a
warning sign that this is not the right answer. Type checking is not a
configuration-level issue; it is a language-level issue. Shoehorning it
into the .ini file is just another band-aid on a broken arm.

We tend to hold new proposals to the litmus test, "can this be effectively
accomplished in userland already?" Well, yeah, in this case it really can.
Making assertions optionally throw isn't some great advancement:

// I can do this now
if  (!is_string($str) && DEBUG) throw new Exception("you bad coder bro");

// I'm all for brevity but does this really need an RFC?
assert(is_string($str), "you bad coder bro");

That's a pretty insignificant, surface-level improvement. Mostly I just
disagree with the assertion (see what I did there?) that this DbC RFC is
remotely the same as what the scalar types RFC is trying to accomplish. And
it certainly doesn't have universal support.

Reply via email to