On Mon, Mar 3, 2014 at 8:57 AM, Antoine Musso hashar+wmf@free.fr wrote:
- Constants declared with 'const' : we use define()
I've been using const. It's nicer syntax.
It seems the two differences is that const can only be used at compile time and that define() let you create case insensitive constants. I guess we could migrate to const though there is no added value beside being 'const' being nicer.
Another difference here is that HHVM performs additional optimizations, like replacing constants with their value at compile time rather than looking up at runtime, when run with production settings (RepoAuthoritative mode). IIUC hhvm only performs these optimizations on const's and not dynamically define()'d values. Its likely a small difference, but useful.
Erik B.
--
Antoine "hashar" Musso
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l