Re: [RFC][Discussion] Parser extension API
| From: | Alexander Lisachenko | Date: | Tue, 17 Feb 2015 19:28:33 +0000 |
| Subject: | Re: [RFC][Discussion] Parser extension API | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-83004@lists.php.net to get a copy of this message | ||
Hello, Lars!
2015-02-17 22:09 GMT+03:00 Lars Strojny <lars@strojny.net>:
> Looks cool and I could see a couple of interesting possibilities arising.
> One thing: any particular reason ExtensionInterface is static? I could see
> a couple of benefits having extensions carry state and registerExtension()
> taking an instance of ExtensionInterface, not a class name. What do you
> think?
Thanks for the positive feedback! My first thought was to use instances for
extensions: https://gist.github.com/lisachenko/ffcfdec4c46e01864b33.
However, I have a doubts that this will introduce additional possibilities
for side-effects, when extensions can be configured
differently/loaded/unloaded. In this thread some people noticed this fact
too and suggested to add a restrictions for preventing conditional parsing
of the source code.
So, static method and static registration was chosen to reduce a number of
possible conditional extensions. This has some disadvantages (testing,
configuration, etc), but should give better experience with parsing
behavior.