Re: [PHP-DEV] PHP header files, restrict to declaring code only

2019-05-15 Thread Robert Hickman
> > That said... most polyfill files, of which there are a decent number, do some > variation on: > > > if (!function_exists('coolness')) { > function coolness(int $coolLevel) { ... } > } > ?> > I can see quite a lot that could be done with preloading by executing code once, essentially compil

Re: [PHP-DEV] PHP header files, restrict to declaring code only

2019-05-14 Thread Larry Garfield
On Mon, May 13, 2019, at 7:49 AM, Johannes Schlüter wrote: > On Fr, 2019-05-10 at 15:14 +0200, Lynn wrote: > > Hi Nikita, > > > > By limiting a header file to declaring code only, a couple of issues > > could > > be tackled: > > > > 1. No side effects when loading files. You can assume the global

Re: [PHP-DEV] PHP header files, restrict to declaring code only

2019-05-13 Thread Johannes Schlüter
On Fr, 2019-05-10 at 15:14 +0200, Lynn wrote: > Hi Nikita, > > By limiting a header file to declaring code only, a couple of issues > could > be tackled: > > 1. No side effects when loading files. You can assume the global > state > remains the same, no >    code is executed by this file, and no

Re: [PHP-DEV] PHP header files, restrict to declaring code only

2019-05-13 Thread Lynn
> Instead of introducing a declare option or special open tag, how about > another "include" construct, that only allows side-effect free (apart > from class loading) operations? > > e.g. "require_noexec 'foobar.php'" > > Regards, Niklas > Hi Niklas, That's indeed a very interesting alternative!

Re: [PHP-DEV] PHP header files, restrict to declaring code only

2019-05-10 Thread Niklas Keller
Instead of introducing a declare option or special open tag, how about another "include" construct, that only allows side-effect free (apart from class loading) operations? e.g. "require_noexec 'foobar.php'" Regards, Niklas -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe,

Re: [PHP-DEV] PHP header files, restrict to declaring code only

2019-05-10 Thread Lynn
On Fri, May 10, 2019 at 3:40 PM Dustin Wheeler wrote: > On Fri, May 10, 2019 at 9:15 AM Lynn wrote: > > > > 2. Certain features, can be restricted to php-header files only, meaning > it > > does not affect > >"normal" PHP files. This might open up a whole new range of syntax > > possibilitie

Re: [PHP-DEV] PHP header files, restrict to declaring code only

2019-05-10 Thread Dustin Wheeler
On Fri, May 10, 2019 at 9:15 AM Lynn wrote: > > 2. Certain features, can be restricted to php-header files only, meaning it > does not affect >"normal" PHP files. This might open up a whole new range of syntax > possibilities that >are currently blocked, such as `@trigger_error()` vs `@Ann

Re: [PHP-DEV] PHP header files, restrict to declaring code only

2019-05-10 Thread Lynn
Hi Nikita, By limiting a header file to declaring code only, a couple of issues could be tackled: 1. No side effects when loading files. You can assume the global state remains the same, no code is executed by this file, and no output can be sent. 2. Certain features, can be restricted to php-

Re: [PHP-DEV] PHP header files, restrict to declaring code only

2019-05-10 Thread Nikita Popov
On Fri, May 10, 2019 at 2:30 PM Lynn wrote: > Hello everyone! > > This is my first mail to the internals, my apologies if I made a mistake > somewhere. > > I would like to propose a new type of php "file" called "phph", short for > "php-header". > This file could receive an optional open-tag: ` `

[PHP-DEV] PHP header files, restrict to declaring code only

2019-05-10 Thread Lynn
Hello everyone! This is my first mail to the internals, my apologies if I made a mistake somewhere. I would like to propose a new type of php "file" called "phph", short for "php-header". This file could receive an optional open-tag: `