declare(strict_types=1)
is that not a bit ironic? declare(strict_types=1)
is that not a bit ironic?Nevertheless, congrats to them, they actually deliver.
People has recently become quite reluctant to 'hate' on php, as if it is some kind of deformed being who needs emotional support. It is like criticizing Christopher Nolan.
You just don't 'hate' on it with out sliding in a few praises. I know that criticizing the language will result in heated (often irritating) debate with the php fan boys (I call them fan boys because other php users will not come justify the language, with things like, "every language has faults so it is ok"). But I think we can use a little less sugar coating. I am not telling that the language should be killed right off, but please just don't romanticize it's faults and send people who are serious about programming down a path they have to (hopefully) come back 9 or 10 years later (When they are finally disillusioned).
EDIT: he..he..downvotes!
declare(strict_typehints=TRUE);
However, I changed it to the form that you see there because it was shorter. I felt that in the grand scheme of things it's not very important: declare() isn't a function, it's a language construct, and saving 5 chars from something that'll be typed very frequently is probably worth it.This mindset is something that I've personally seen uniquely permeate every layer of the PHP community, more than anywhere else. I'm honestly curious, what makes communities seem to value things like typing less characters over clarity and correctness? The most important thing to me is reducing the amount of mental state needed for a human to read any line of code.
The language itself feels like a bag of features copied over from top contenders from the TIOBE index. You can see the fastness in the core of the language design.
After all, you use PHP to perform MySQL queries in the middle of HTML tags. If you want to do this, you know some principles are merely burden for your smooth execution of the web site development, and should be throw out the window at first thought.
The sort of approach you're describing is not suggested or used by anyone with half a clue what they're doing.
declare(types=strict);
instead. That way other options can be added in the future. <?hh // strict
Strict what?Well, it could've been this:
declare(types="strict");
Alas, we are beyond feature-freeze now. Also, I quit PHP development.For some reason, this Easter egg was deemed too important to displace with an actual language construct.
declare(strict_typehints=TRUE); // not ironic, not short
declare(strict_types=1); // ironic, short
declare(strict=true); // not ironic, even shorter
JS has one strict mode, this could've been an opportunity to introduce an umbrella mode for strict coding in general.Also the declare syntax could've been augmented to support passing implicit boolean parameters without setting a value:
declare(strict); // oh yeah.
So... you know. Not that it matters what you call it, but choosing ugly (and ironic) over pretty (and sane) shouldn't be taken so lightly.