
Taking PHP Seriously - ArabGeek
http://www.infoq.com/presentations/php-history#.Ut-aQoM8B8A.twitter
======
smoyer
With an optimizing compiler to boost its performance, I think PHP would still
benefit from two things:

1) A resource like "PHP - The Good Parts", that guided developers through the
dos and don'ts of the language at an early stage.

2) An overlay language (like Coffeescript over Javascript) that effectively
hides the bad parts, but that might also be extended to bring some consistency
to the library APIs (even a bunch of aliases that used consistent naming rules
would help).

I'll admit that I have written anything serious in PHP since the late '90s but
those are the issues we had bring new developers up to speed.

~~~
RossM
1) sort of exists in [http://phptherightway.com/](http://phptherightway.com/)

2) There's been a couple of these, most recently Mammouth[0], but personally I
don't think that's useful - the syntax is more or less OK. I do think that
renaming the core functions and then providing an alias/compatibility library
would be beneficial however.

Personally, the most inviting part of HHVM for me isn't the performance, it's
the alternative team that seem willing to develop the language more in-line
with what users want.

[0]: [https://github.com/btwael/mammouth](https://github.com/btwael/mammouth)

~~~
jbeja
For 2) there is
[https://github.com/runekaagaard/snowscript](https://github.com/runekaagaard/snowscript)

~~~
kodablah
I also wrote one for fun at
[http://cretz.github.io/pratphall](http://cretz.github.io/pratphall), but I
have come to the conclusion that cross compiling to PHP isn't practical. The
whole point is that it's easy to write and see the results right away.

------
NigelTufnel
Going JIT seems to be the common way of the scripting/bytecode-compiled
languages.

Java -> HotSpot, Python -> PyPy, Javascript -> V8 and friends, PHP -> HHVM

~~~
pjmlp
Lisp and Smalltalk were the first ones.

~~~
lispm
McCarthy is mentioned for that, but I guess more work on that was done in the
Smalltalk and Self context.

Since quite some time most Lisp systems don't use a JIT. They compile the code
ahead of time or explicitly incrementally.

~~~
pjmlp
> Since quite some time most Lisp systems don't use a JIT. They compile the
> code ahead of time or explicitly incrementally.

I am aware of type hints, but given Lisp's dynamic nature, wouldn't a JIT
provide more optimized code than AOT?

------
Xdes
It would be nice if they just reinvented PHP. Get the top 20 major frameworks
behind them and fork it.

~~~
acdha
They're proposing essentially that: start at the 24th slide
[http://www.slideshare.net/zerutreck/taking-php-seriously-
kei...](http://www.slideshare.net/zerutreck/taking-php-seriously-keith-adams)

The smart part is that it's opt-in so you could gradually migrate a large
project in-place. The only question would be whether they've broken
compatibility with standard PHP or if it's simply stricter — it'd be really
easy to get major projects to switch if it was like JavaScript's "use strict"
where you can develop in strict mode but run on a legacy runtime.

~~~
Xdes
I'll have to take a look at the Hack language. I've always wanted to try PHP,
but I've always been deterred by the cruft (same reason I avoid Java).

------
Kiro
Previous discussion:

[https://news.ycombinator.com/item?id=7054294](https://news.ycombinator.com/item?id=7054294)

------
untilHellbanned
Is there a "how to" in using this with PHP framework X?

Perhaps HHVM just need to be installed and then a change to your Nginx/Apache
config needs to happen?

Serious kudos to FB and the developers who are making this happen!

------
riffraff
if you are discounting this discussion on account of not being interested in
the VM consider it's also quite interesting for the way they changed the
language.

E.g. gradual typing with type inference, generics, closures, nullable types,
generators and a lot of static checks and removals of "arguably dumb" php
features.

------
mjohan
What is different from the intermediate code HHVM generates and the code that
OPcache/apc stores? Is HHVM always faster compared to code that is cached in
OPcache/APC?

~~~
martinml
An opcache code just stores the bytecode so you just avoid the parsing step in
each request. It does not inherently optimizes anything, although it has been
tried with APC in the past (but finally abandoned). I don't know what's the
status with the new official opcache and optimization.

------
Nilzor
tl;dr what is HHVM and why should I care as a PHP developer?

~~~
philo23
HipHop Virtual Machine, it "compiles" PHP into C++. Though it needs to be
written in a certain way to work correctly as I understand it.

~~~
plextoria
No, it does not compile to C++, but to bytecode. HHVM's predecessor converted
PHP to C++, though.

~~~
blowski
What's the difference between that and APC? The performance, or is there
something else?

Confession: I haven't listened to the OP yet.

