Live data from Hacker News

The new PHP

programming.oreilly.com

61–70 of 203 posts

Re: The new PHP

#61

Earlier quoted context omitted.

1. Why add complexity when it isn't necessary? Inline output is one of the best features of PHP in that it makes it extremely easy to get started using it. If you want templates you can add them. Not everyone wants them. 2. PHP is dynamically typed, like many other languages, and so you just have to know what types something can be and how they behave together. Even in a statically typed language you need to know how…

Easy to get started, then what? I didn't learn how to structure big projects until I moved to better languages that encourage (through defaults) better practices. Predictable !== well defined. If you have to look through a chart for equivalence, it's unpredictable to the programmer. But this is a theme for all of PHP, you can't deduct equivalence, function names and function arguments orders, you have to memorize or…

"better practices" for what?

The requirements for a huge (often overgeneralised) enterprise application are very different from a little script for personal or small-community use. There are far more of the latter than the former, and those wanting to "get started with web programming" are going to start out with that too.

Re: The new PHP

#62
post #60
post #16

Earlier quoted context omitted.

Just because a tool can be misused is not an argument against it nor its inclusion. I used to believe this, but now I couldn't disagree more. People can and do misuse things all the bloody time, and the more you enable them to do that, the worse your tool is. How people use what you make is every bit as important, possibly even more important than the technical merits of what you make. I'd rather a builder use a seco…

I don't hear people complaining about Python's builtin webserver. Maybe thats because Python only attracts people who do things correctly right?

Python doesn't have a builtin webserver, but there is one in standard library of CPython.

I've yet to see an article that would argue that its existence is a proof that you should be using Python now.

Re: The new PHP

#63
post #51
post #41

Earlier quoted context omitted.

check what PyPy did (or is doing with PHP).

Could you please explain it a bit or provide a link?

http://morepypy.blogspot.com/2012/07/hello-everyone.html

> I'm proud to release the result of a Facebook-sponsored study on the feasibility of using the RPython toolchain to produce a PHP interpreter. The rules were simple: two months; one person; get as close to PHP as possible, implementing enough warts and corner cases to be reasonably sure that it answers hard problems in the PHP language. The outcome is called Hippy VM and implements most of the PHP 1.0 language (functions, arrays, ints, floats and strings).

Re: The new PHP

#64
post #51

Earlier quoted context omitted.

Could you please explain it a bit or provide a link?

http://morepypy.blogspot.com/2012/07/hello-everyone.html > I'm proud to release the result of a Facebook-sponsored study on the feasibility of using the RPython toolchain to produce a PHP interpreter. The rules were simple: two months; one person; get as close to PHP as possible, implementing enough warts and corner cases to be reasonably sure that it answers hard problems in the PHP language. The outcome is called H…

Thanks, seems very impressive

Re: The new PHP

#65

> generators for simpler iteration, namespaces, and variadic functions and argument unpacking. With PHP 5.4, traits were introduced (a la Scala or Perl) to allow code reuse in single inheritance languages, as well as closures, which allow you to code PHP in a functional style. "The new Java" It's good to see PHP maturing. However sometimes the most important features of a language are the features you don't add. I th…

It's a weird problem. A 6 major release may be the only time to do such things, and people here think it would be a disaster. I don't know if it's possible at all to retrofit language improvements into the stdlib.. do you write a parallel one or do you write books hoping people will catch on the latest way to write good code ?

Yeah, that's a huge issue with Perl 6. The language is nowhere near backwards-compatible with Perl 5, and it can't be easily retrofitted to be. So perl 6 is basically becoming its own language in parallel rather than the successor as was originally planned.

It will be interesting to see if PHP goes that route or not.

Re: The new PHP

#66
post #34
post #2

> It contains powerful new features and helpful developer tools, such as a built-in web server I haven't finished the article yet, but really? Is that what PHP needs? A built-in web server? It strikes me that adding more tools that incompetent web developers can abuse is what got them there in the first place. How long until we start having security releases for the PHP web server, because so many clueless devs decid…

Umm, like Node?

Not really like node, no. The node http module is part of the standard library and you can use it to build a custom web server. The php web server is built into the php binary, and you can use it to serve up some portion of your filesystem as a PHP app.

So it's more like `python -m SimpleHTTPServer` than the node http module.

Re: The new PHP

#67

> generators for simpler iteration, namespaces, and variadic functions and argument unpacking. With PHP 5.4, traits were introduced (a la Scala or Perl) to allow code reuse in single inheritance languages, as well as closures, which allow you to code PHP in a functional style. "The new Java" It's good to see PHP maturing. However sometimes the most important features of a language are the features you don't add. I th…

There's some discussion on the RFCs and mailing lists about creating new backwards-incompatible OO APIs for the core libraries which would eventually replace some of the legacy mess.

Re: The new PHP

#68
post #39

I don't get it. Why people can't just admit the fact that PHP had his time and now, no one with common sense would not start new project (except simple wordpress stuff) in PHP.

Facebook, blogs and open source enterprise CMS would disagree with you.

Facebook doesn't even use PHP anymore, they switch to their own implementation of PHP called Hack to runs on HHVM. So no, they don't use PHP per se for anything this days.

http://www.infoq.com/interviews/adams-php-facebook

Re: The new PHP

#69
post #21
post #5

Earlier quoted context omitted.

The web server is explicitly for development purposes. It is not meant for production. > It strikes me that adding more tools that incompetent web developers can abuse is what got them there in the first place. This is profoundly ridiculous. It's the equivalent of saying Home Depot shouldn't sell power tools because some do-it-yourselfer might saw his foot off. Just because a tool can be misused is not an argument ag…

No its like saying Home Depot shouldn't sell power tools to children who don't know how to safely use them. Unless the web server displays a huge red message every time it is run saying "Don't even think about using this in production" you can bet that it will be.

> Unless the web server displays a huge red message every time it is run

Uhh... this is the first line the web server spits out:

PHP 5.4.0 Development Server started at Thu Jul 21 10:43:28 2011

The manual isn't exactly vague on this point either:

http://us3.php.net/manual/en/features.commandline.webserver....

So we got the warning already in there, what else would you like?

Re: The new PHP

#70

Earlier quoted context omitted.

1. Why add complexity when it isn't necessary? Inline output is one of the best features of PHP in that it makes it extremely easy to get started using it. If you want templates you can add them. Not everyone wants them. 2. PHP is dynamically typed, like many other languages, and so you just have to know what types something can be and how they behave together. Even in a statically typed language you need to know how…

Easy to get started, then what? I didn't learn how to structure big projects until I moved to better languages that encourage (through defaults) better practices. Predictable !== well defined. If you have to look through a chart for equivalence, it's unpredictable to the programmer. But this is a theme for all of PHP, you can't deduct equivalence, function names and function arguments orders, you have to memorize or…

"I didn't learn how to structure big projects until I moved to better languages that encourage (through defaults) better practices."

Do you think that PHP is the only language where developers look to other practices in other language communities to learn different/new/better/changing practices? Every good developer is aware of patterns and structures in other languages/platforms - I dare say it's almost the definition of a good developer. I would not regard a Ruby developer who'd only ever done Rails projects as a 'good' developer, regardless of how clean/elegant the code seems.

Post reply on HN