Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

    "use strict";
(note 'use' is part of a string) should work in PHP for the same reason it does in ECMAScript -- it is a no-op at the language level (creating a string literal and doing nothing with it), that is unlikely to appear in old code, and can be given new meaning in the next-level language spec.


Maybe. But it means the parser now needs to "make sense" of strings whereas before it was just skipping over them.


No it doesn't. The "use strict" declaration must occur before any other statements, allowing the parser to look specifically for those bytes, and treat it as a separate token instead of as a string. It doesn't have to inspect the contents of all strings.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: