Live data from Hacker News

Comparing the PHP 7 and Hack Type Systems

dmiller.io

21–30 of 38 posts

Re: Comparing the PHP 7 and Hack Type Systems

#21

I believe that 1 == true as much as the next nerd, but still, this line: declare(strict_types=1) is that not a bit ironic?

Yes, and as the person who came up with that, I was well aware of the irony. It was originally this: 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.

I sort of wish you had done:

  declare(types=strict);
instead. That way other options can be added in the future.

Re: Comparing the PHP 7 and Hack Type Systems

#22

I believe that 1 == true as much as the next nerd, but still, this line: declare(strict_types=1) is that not a bit ironic?

I think so, too. I know, I am just hating, but to me it seems like they just can not quite change their culture. Even if they implement something clean and elegant like strong typing their hacky past finds a way to slip in. Nevertheless, congrats to them, they actually deliver.

> I know, I am just hating...

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!

Re: Comparing the PHP 7 and Hack Type Systems

#23

I believe that 1 == true as much as the next nerd, but still, this line: declare(strict_types=1) is that not a bit ironic?

Yes, and as the person who came up with that, I was well aware of the irony. It was originally this: 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.

As someone who will be typing it very frequently, I wish the more verbose and obvious version had won out.

Re: Comparing the PHP 7 and Hack Type Systems

#24

Earlier quoted context omitted.

Yes, and as the person who came up with that, I was well aware of the irony. It was originally this: 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.

> 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…

Because PHP is for really fast development, and not for slow movers who actually think a lot. That's what I sense after joining a company using PHP.

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.

Re: Comparing the PHP 7 and Hack Type Systems

#25
post #24

Earlier quoted context omitted.

> 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…

Because PHP is for really fast development, and not for slow movers who actually think a lot. That's what I sense after joining a company using PHP. 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 kno…

Just because you can do something doesn't mean you should

The sort of approach you're describing is not suggested or used by anyone with half a clue what they're doing.

Re: Comparing the PHP 7 and Hack Type Systems

#26

Earlier quoted context omitted.

I think so, too. I know, I am just hating, but to me it seems like they just can not quite change their culture. Even if they implement something clean and elegant like strong typing their hacky past finds a way to slip in. Nevertheless, congrats to them, they actually deliver.

> I know, I am just hating... 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 wi…

Upvote.It's getting over complicated each update and not for simple development.While language like c# get more easier like old days php.

Re: Comparing the PHP 7 and Hack Type Systems

#27
post #21

Earlier quoted context omitted.

Yes, and as the person who came up with that, I was well aware of the irony. It was originally this: 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.

I sort of wish you had done: declare(types=strict); instead. That way other options can be added in the future.

i quite like this concept too, but both are still better than Hack's

    
Strict what?

Re: Comparing the PHP 7 and Hack Type Systems

#28
post #21

Earlier quoted context omitted.

Yes, and as the person who came up with that, I was well aware of the irony. It was originally this: 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.

I sort of wish you had done: declare(types=strict); instead. That way other options can be added in the future.

Not syntactically legal, unless it's special-cased or we unusually make a lowercase constant for that purpose. declare() takes a constant value.

Well, it could've been this:

    declare(types="strict");
Alas, we are beyond feature-freeze now. Also, I quit PHP development.

Re: Comparing the PHP 7 and Hack Type Systems

#29

Earlier quoted context omitted.

Yes, and as the person who came up with that, I was well aware of the irony. It was originally this: 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.

> 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…

In this case I don't think it sacrifices much clarity, and it avoids the word "typehint" which is controversial (correctness is disputed). Using TRUE wouldn't necessarily be more correct, it's fairly arbitrary.

Re: Comparing the PHP 7 and Hack Type Systems

#30
post #21

Earlier quoted context omitted.

I sort of wish you had done: declare(types=strict); instead. That way other options can be added in the future.

i quite like this concept too, but both are still better than Hack's Strict what?

Hack's is a comment, not a proper pragma, too.
Post reply on HN