News for hackers. Stuff that matters.
Re:Making PHP Safer by bovermyer on Friday January 31, 2014 @04:52PM (#7159411)
I hate annotations in PHP. They feel very tacked-on. I'd much rather see actual enforced typing in the language.

This is a step in the right direction, but it doesn't go far enough, in my opinion.

Re:Making PHP Safer by mildtrepidation on Friday January 31, 2014 @06:07PM (#7159787)
In a very literal sense, everything in PHP is tacked on. It's a conglomeration of crap. You could replace "crap" with something more politically correct in that sentence, but it could not possibly be more literally correct.

Annotations. Namespaces. There is nothing in PHP that was not an afterthought. While it could technically be considered "unfair" to criticize the language in that respect, the total failure to push it in any rational direction in the last decade or two says nothing about the language, but speaks volumes about the people in charge of it.

PHP is a horrible, horrible failure. Not a failure in the sense that it doesn't work; it does. It does what it was and is intended to. But it does that in such an absolutely shitty way, and with such a grotesque mountain of horrid workarounds and terrible hacks that are sometimes called features, that there is no excuse for the way this language has evolved.

It works. And it's used all over the place. But that doesn't make it good. If the road to hell is paved with good intentions, then PHP is the express route.

Re:Making PHP Safer by markdown on Friday January 31, 2014 @06:44PM (#7159979)
Thank goodness there are people in this world who care more about shipping than about perfection.

Thank goodness there are people who have thicker skin than I, and release FOSS to the world despite comments like yours.

Re:Making PHP Safer by frowaway001 on Friday January 31, 2014 @07:46PM (#7160301)
And if others listened to people like you, we would all still live on trees.
Re:Making PHP Safer by Aqueous on Friday January 31, 2014 @07:04PM (#7160103)
While I agree with nearly every assertion you make, I'm still hazy on what 'good' is. Surely the fact that so many people find PHP the most productive language they could've worked with, and produce mountains and mountains of working code that is at least mostly reliable - don't those qualities alone make it in some sense good?

Then again I think some pop music is good, so I'm starting from a point where I don't necessarily think being popular makes something mediocre.

That said, I really hate being forced to write in PHP because of its complete inelegance, so much so that I have left all my legacy PHP in a burning garbage heap and ran screaming to Scala, where type safety is a given. But as I'm being forced to move back to PHP for a project because of a client's demands I'm trying to look at the silver lining of programming with it. Sometimes it takes some squinting but it is possible to appreciate what PHP has accomplished.

Re:Making PHP Safer by ChikkaChiChi on Friday January 31, 2014 @07:19PM (#7160194)
There can be elegance found in writing well-formed code of any language. It may be tougher in PHP, but it's certainly possible.

To use a car analogy, I have more respect for the guy running an old Mustang he tunes up and runs a 11 second quarter-mile than the jackass who drops 200 large on an exotic that pulls a 10.

Re:Making PHP Safer by wvenable on Friday January 31, 2014 @09:27PM (#7160594)
> the total failure to push it in any rational direction in the last decade or two says nothing about the language, but speaks volumes about the people in charge of it.

This claim has no basis and the rest of your rant is a tautology. There's been no attempt to improve the language but all the improvements are afterthoughts?!? You can't have it both ways. I'm disappointed this post is grayed out and your post isn't.

Re:Making PHP Safer by fooyc on Friday January 31, 2014 @07:05PM (#7160107)
PHP doesn't have annotations.

The framework you are using may be emulating them, though.

Re:Making PHP Safer by bnr on Friday January 31, 2014 @07:59PM (#7160337)
Facebook is doing something similar, but instead of annotations they are breaking syntax compatibility (for the better, I think). This talk is unfortunately the only reference i can find: http://www.infoq.com/presentations/php-history relevant part starts around minute 22.
Re:Making PHP Safer by fooyc on Friday January 31, 2014 @07:07PM (#7160115)
PHP doesn't have annotations.

The framework you are using may be emulating them, though. By parsing docblocks. Hence why it feels like that.

Re:Making PHP Safer by sigzero on Friday January 31, 2014 @05:17PM (#7159549)
That's because PHP is a tacky language. :)
Re:Making PHP Safer by ukandy on Friday January 31, 2014 @06:58PM (#7160065)
Yes I dislike the use of 'annotations'.

Would it not be better to catch the recoverable error that "function foo (integer $a)" gives, then use your error handler to check that $a is an integer?

Re:Making PHP Safer by p4lindromica on Friday January 31, 2014 @08:19PM (#7160400)
This does not satisfy the requirement of low performance implications. Augmented Types works by wrapping zend_compile and adding opcodes to to the compiled PHP to check the types of the arguments. This way Augmented Types can be run once at compile time (yes, PHP is compiled) and ensure type safety of all subsequent invocations.
Re:Making PHP Safer by wvenable on Friday January 31, 2014 @09:28PM (#7160600)
This is sort of a test/development only feature -- so making use of annotations makes sense. Running annotated code on a vanilla PHP install (without this extension) will work perfectly fine. You only get the extra checks with the extension enabled.
Re:Making PHP Safer by al2o3cr on Friday January 31, 2014 @06:00PM (#7159746)
Good luck with "actual typing" - I don't think a language that believes "0" > "01" ('numerical strings' FTL) is really suited to it.