hi,
I put my thoughts and summary of the recent discussions about what
could be PHP 6 here:
https://wiki.php.net/ideas/php6
Things like "we should name it php7" has not been covered, for one
obvious reasons.
It is not a TODO list but a list of proposals I would like to see us
discuss, work on, push harder. They are features, changes, etc. I have
been hearing for years and things we should really give more
attention.
Please do not mass reply to this thread but prefer to create one new
thread per topic. Who knows, we may get enough input to create one
wiki page per topic. And if you are lucky enough, we may even have
some working groups for each of them?
Happy reading, comments, feedback and the likes welcome!
Cheers,
Pierre
@pierrejoye | http://www.libgd.org
Hi!
Here's a bunch of mine:
- Clean up error reporting (let's decide - do we want exceptions?
Warnings? Both?), make errors not so damn expensive and fix @ to be much
more lean-and-mean than it is now. - Figure out named args. I think it's time.
- Bringing mbstring, various submodules of intl and assorted other
things under one roof as proper support for everything one needs with
i18n and l10n (maybe part of "Unicode support") - Cleaning up resources handling so that various scenarios like "I freed
resource in error handler and now my code segfaults" wouldn't happen. - Cleaning up LSP rules for inheritance checks, we still have some weird
cases lurking there AFAIR - Plug serialize/dtor hole, it's really not good that unserializing data
allows one to mess up with stuff. - Create a robust design for escaping stuff, so it would be clear what
should be escaped, in which context and which encoding, etc.
OK, I think enough for now :)
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227
Hi!
Here's a bunch of mine:
- Clean up error reporting (let's decide - do we want exceptions?
Yes, I wanted that as part of cleaning APIs (errors are parts of
APIs), but you are right, it is and should be a topic on its own.
Warnings? Both?), make errors not so damn expensive and fix @ to be much
more lean-and-mean than it is now.
Kill it could be an option too. I see the need of @ as a design failure.
- Figure out named args. I think it's time.
Oh I forgot that one :)
- Bringing mbstring, various submodules of intl and assorted other
things under one roof as proper support for everything one needs with
i18n and l10n (maybe part of "Unicode support")
Yes, I think it is part of the "Unicode" and "i18N/L10N" support too.
- Cleaning up resources handling so that various scenarios like "I freed
resource in error handler and now my code segfaults" wouldn't happen.- Cleaning up LSP rules for inheritance checks, we still have some weird
cases lurking there AFAIR
I would rather kill them and relies on objects ;-)
- Plug serialize/dtor hole, it's really not good that unserializing data
allows one to mess up with stuff.
That's a detail, ok, an annoying details but I would like to focus on
say top 10 thing we need, things that will require many
discussions/time to design :)
- Create a robust design for escaping stuff, so it would be clear what
should be escaped, in which context and which encoding, etc.
Good point, I think the escaping RFC could be a good starting point.
Cheers,
Pierre
@pierrejoye | http://www.libgd.org
Pierre Joye wrote:
Warnings? Both?), make errors not so damn expensive and fix @ to be much
more lean-and-mean than it is now.
Kill it could be an option too. I see the need of @ as a design failure.
Is ICU an indication of how this should be handled as well. Being able to switch
exceptions off in intl demonstrates that they may not be necessary.
--
Lester Caine - G8HFL
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk
Pierre Joye wrote:
Warnings? Both?), make errors not so damn expensive and fix @ to be much
more lean-and-mean than it is now.
Kill it could be an option too. I see the need of @ as a design failure.
Is ICU an indication of how this should be handled as well. Being able to
switch exceptions off in intl demonstrates that they may not be necessary.
a library which is built around supporting exceptions can work, but
currently we have a bunch of code (both in the core and in userland), which
doesn't support that.
errors can support the execution of the execution, which means allowing to
have return values, or emiting multiple errors from the same call, with
exceptions you can't do that, as the execution will jump to the next catch
block (or to the global exception handler).
I don't think I have seen any proposal so far which would solve these
issues, yet people still talking about like replacing the current error
handling infrastructure with exceptions would be a viable alternative.
--
Ferenc Kovács
@Tyr43l - http://tyrael.hu
Ferenc Kovacs wrote:
Warnings? Both?), make errors not so damn expensive and fix @ to be much >more lean-and-mean than it is now. Kill it could be an option too. I see the need of @ as a design failure. Is ICU an indication of how this should be handled as well. Being able to switch exceptions off in intl demonstrates that they may not be necessary.
a library which is built around supporting exceptions can work, but currently we
have a bunch of code (both in the core and in userland), which doesn't support that.
errors can support the execution of the execution, which means allowing to have
return values, or emiting multiple errors from the same call, with exceptions
you can't do that, as the execution will jump to the next catch block (or to the
global exception handler).
I don't think I have seen any proposal so far which would solve these issues,
yet people still talking about like replacing the current error handling
infrastructure with exceptions would be a viable alternative.
While the discussion has also been opened up to include C++ which use
'exceptions' in normal process flow, IS it a given that we have to have
exceptions at all? To my mind proper error handling should prevent the 'white
screen' as the only way of handing things when everything has gone tits up? :(
--
Lester Caine - G8HFL
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk
While the discussion has also been opened up to include C++ which use
'exceptions' in normal process flow, IS it a given that we have to have
exceptions at all? To my mind proper error handling should prevent the 'white
screen' as the only way of handing things when everything has gone tits up? :(
Yes, we need Exceptions as Exceptions are the only good way to report
recoverable errors from constructors.
The reason C++ libraries like ICU allow disabling exceptions (if that's
the case, haven't researched) is that many projects disable exceptions
while compiling. Reason for that are
a) longterm users don't trust the compiler to create as efficient code
(fact is the code generated by modern C++ compilers typically is more
efficient than code with "classic" error handling, which includes
more branches)
b) Writing exception safe code in C++ isn't easy. Proper use of smart
pointers and RAII makes this viable. But many legacy libraries don't
follow those patterns. Contrary to PHP there is no native ref
counting / GC in C++ so non-exception-safe code leads to resource
leaks.
Both things aren't that kind of issues in PHP. Preventing a white page
for exceptions can be done with a error handler catching unhandled
exceptions.
johannes
hi,
I put my thoughts and summary of the recent discussions about what
could be PHP 6 here:https://wiki.php.net/ideas/php6
Things like "we should name it php7" has not been covered, for one
obvious reasons.It is not a TODO list but a list of proposals I would like to see us
discuss, work on, push harder. They are features, changes, etc. I have
been hearing for years and things we should really give more
attention.Please do not mass reply to this thread but prefer to create one new
thread per topic. Who knows, we may get enough input to create one
wiki page per topic. And if you are lucky enough, we may even have
some working groups for each of them?Happy reading, comments, feedback and the likes welcome!
I'd add :
-
Change compiler design : build a new hookable AST-based compiler
that would allow modules (extensions) to hook into the AST for custom
compilation rules. -
Start a reflection about threaded VM : We could start designing a
threaded model and use it for I/Os at first. Our VM should be able to
do several things at the same time and we should prevent it from
waiting for operation results (I/Os). -
If we could redesign objects and arrays so that they could be
interchanged in many functions accepting arrays would be nice. Both
arrays and objects could share a common structure holding the data
that would be used when using such functions. -
Add new structures such as Generics, we need that
-
Extend type hinting to scalars
-
Improve PHP syntax so that compiler can make optimizations, such as
having allowing the declaration of read only variables : "public
static const $a".
More ideas to come...
Julien
Before opening a new thread about JIT, I have one simple question.
The wiki page created by Pierre talks about LibJIT. This library has an
integrated interpreter (for platforms where JIT is not available). I don't
know anything about the speed of this interpreter, but maybe it could be
interresting to evaluate it as the lone interpreter in the PHP engine. Is
anyone thinked about that?
2014-02-17 7:28 GMT+01:00 Pierre Joye pierre.php@gmail.com:
hi,
I put my thoughts and summary of the recent discussions about what
could be PHP 6 here:https://wiki.php.net/ideas/php6
Things like "we should name it php7" has not been covered, for one
obvious reasons.It is not a TODO list but a list of proposals I would like to see us
discuss, work on, push harder. They are features, changes, etc. I have
been hearing for years and things we should really give more
attention.Please do not mass reply to this thread but prefer to create one new
thread per topic. Who knows, we may get enough input to create one
wiki page per topic. And if you are lucky enough, we may even have
some working groups for each of them?Happy reading, comments, feedback and the likes welcome!
Cheers,
Pierre
@pierrejoye | http://www.libgd.org
We could all look of what users are willing for too... there was a thread
on Reddit about it.
Here was my comment:
http://www.reddit.com/r/PHP/comments/1iw0cj/what_would_you_change_about_php_if_you_could/cb9rzw4
Here is the comment for lazy readers.
My suggestion back in 2011 was to rewrite Zend Engine to accommodate a few
things that people are considering as must-haves nowadays. Based on
history, each ZE is rewritten after every 5 years (1996 - 2001 for ZE1,
2001 - 2005 for ZE2), which hints we may be in a need to reevaluate current
code and plan support for next 5 years.
A couple of things to motivate:
- Native Unicode support
- Make opcode cache native
- Better garbage collector
- Add basic support for interceptors (preConstruct, postDestroy,
aroundInvoke) - Operator overloading, allowing things like Comparable interface
- Attempt to simplify language operators/keywords/symbols
- Native ctype support (no, not the current supported one. Look for its
support in Python) - With better opcache and ctype, also add better
dl()
, completely
removing the need to have so many extensions in core - Remove "global" support
- Errors to exceptions
- Consistent exception messages
- Scalar type hinting
- Named Parameters
- Annotations
- Default class resolution/loading (aka. Native PSR-0 support)
- Remove error suppression (@ operator)
- C# style mutators and accessors
- Comparable interface
- Collection, Map, Set, List, Bag
- Namespace visibility
- Namespace Variables
- Namespace Reflection API
- Drop optional property/method visibility support (make them required)
- Polymorphism (aka. method overloading)
- Virtual methods
- pecl_http into core (considering better
dl()
item isn't accepted) - Previous item would lead to complete removal of superglobals
- Normalize overall current/future design for the language (why
__toString, __wakeup, __sleep vs. Jsonable or Serializable interfaces?) - Primitive types (enhance SplInt et al. and make them native, with
actual <type>_* required methods and discard nice to have ones) - Add valuable to these primitive types (oh, and make the default
parameter ordering. Not everyone would love to keep using named parameters
over and over) - Make native functions support Spl* instances (ie.: substr(new
SplString('foobar'), 0, 3)) as a beginning to remove overall functions
support - "Strict" variable types (relies on previous 2: type hinting, type
inference, type casting, return types. Quotes were added because they would
be inferred, not declared. That would force assignments to validate types,
such as $a =1; $a=false; would throw an exception because you're changing
variable type) - Remove functions from global namespace
- Threads support (no, don't tell me about pthreads extension)
- Shorthand functions declaration somehow
- Get rid of aliased functions
- Basically apply Poka-Yoke principle to the language. There should be
only one way of doing a given action
Hm... I think that's enough for now! =)
Cheers,
Before opening a new thread about JIT, I have one simple question.
The wiki page created by Pierre talks about LibJIT. This library has an
integrated interpreter (for platforms where JIT is not available). I don't
know anything about the speed of this interpreter, but maybe it could be
interresting to evaluate it as the lone interpreter in the PHP engine. Is
anyone thinked about that?2014-02-17 7:28 GMT+01:00 Pierre Joye pierre.php@gmail.com:
hi,
I put my thoughts and summary of the recent discussions about what
could be PHP 6 here:https://wiki.php.net/ideas/php6
Things like "we should name it php7" has not been covered, for one
obvious reasons.It is not a TODO list but a list of proposals I would like to see us
discuss, work on, push harder. They are features, changes, etc. I have
been hearing for years and things we should really give more
attention.Please do not mass reply to this thread but prefer to create one new
thread per topic. Who knows, we may get enough input to create one
wiki page per topic. And if you are lucky enough, we may even have
some working groups for each of them?Happy reading, comments, feedback and the likes welcome!
Cheers,
Pierre
@pierrejoye | http://www.libgd.org
--
--
Guilherme Blanco
MSN: guilhermeblanco@hotmail.com
GTalk: guilhermeblanco
Toronto - ON/Canada
Hi,
My suggestion back in 2011 was to rewrite Zend Engine to accommodate a few
things that people are considering as must-haves nowadays. Based on
history, each ZE is rewritten after every 5 years (1996 - 2001 for ZE1,
2001 - 2005 for ZE2), which hints we may be in a need to reevaluate current
code and plan support for next 5 years.
ZE2 is not a rewrite. PHP 5.1 or 5.2, not sure, had a completely new
executor,aside from that there mostly were extensions.
A couple of things to motivate:
- Native Unicode support
Complicated one, see other threads.
- Make opcode cache native
What does that mean? What's the expected benefit over opcache?
- Better garbage collector
In what sense?
- Add basic support for interceptors (preConstruct, postDestroy,
aroundInvoke)
This can be added by extensions if needed.
- Operator overloading, allowing things like Comparable interface
No. Please not.
- Attempt to simplify language operators/keywords/symbols
A part of PHP's design is to have keywords which can be googled for,
short operators, notations make it harder if one stumbles over unknown
constructs. Any precise examples?
- Native ctype support (no, not the current supported one. Look for its
support in Python)
Not an engine feature. feel free to provide an extension API, eventually
might be bundled. (and enabled by default / force)
- With better opcache and ctype, also add better
dl()
, completely
removing the need to have so many extensions in core
Better dl is not trivial due to operating system restrictions. With
major refactoring we might improve this a bit, but things which come to
mind cause major breakage in APIs for quite little effect ... I thought
a while about this in regards to composer etc.
- Remove "global" support
Why?
- Errors to exceptions
Complicated one, not all errors we have can a) be recovered and b) are
actual errors. Needs a good concept (see also other thread)
- Consistent exception messages
Feel free to go through it and propose something, that's quite abstract.
- Scalar type hinting
- Named Parameters
- Annotations
See other threads.
- Default class resolution/loading (aka. Native PSR-0 support)
Again nothing related to the engine, if that is implemented in an
internal function for spl or such it might be added. Shouldn't be too
complex (except that user-space implementations are simpler to debug for
users if something goes wrong)
- Remove error suppression (@ operator)
Unless error handling is revamped this is needed.
- C# style mutators and accessors
See RFC.
- Comparable interface
See other thread.
- Collection, Map, Set, List, Bag
collection is a generic term, not sure what you mean. A PHP array is a
map. We have lists in SPL. A bag (multiset/multimap) can be emulated in
a nested array ... if there is need SPL could be extended.
- Namespace visibility
- Namespace Variables
- Namespace Reflection API
for the later we'd indeed have to refactor the engine in a way to have
more overhead from namespaces. This might also be needed in casethe
others are requested ... might need details.
- Drop optional property/method visibility support (make them required)
Why?
- Polymorphism (aka. method overloading)
Hard to do in a dynamic language in an efficient way. will slow down
each and every function call unless somebody has a good idea. Till then
we prefer extra cost for the implementor in the few times this is
needed.
- Virtual methods
what should this be in the context of PHP? From a C++ sense all PHP
methods are virtual.
- pecl_http into core (considering better
dl()
item isn't accepted)
might be interesting.
- Previous item would lead to complete removal of superglobals
Why that? To break every single PHP script out there?
- Normalize overall current/future design for the language (why
__toString, __wakeup, __sleep vs. Jsonable or Serializable interfaces?)
any proposal keeping a viable BC way?
- Primitive types (enhance SplInt et al. and make them native, with
actual <type>_* required methods and discard nice to have ones)- Add valuable to these primitive types (oh, and make the default
parameter ordering. Not everyone would love to keep using named parameters
over and over)- Make native functions support Spl* instances (ie.: substr(new
SplString('foobar'), 0, 3)) as a beginning to remove overall functions
support- "Strict" variable types (relies on previous 2: type hinting, type
inference, type casting, return types. Quotes were added because they would
be inferred, not declared. That would force assignments to validate types,
such as $a =1; $a=false; would throw an exception because you're changing
variable type)
See old discussions on type hints etc.
- Remove functions from global namespace
Why?
- Threads support (no, don't tell me about pthreads extension)
for what purpose? We should imo rather focus on async operations. Doing
complex operations in parallel on a loaded web frontend doesn't seem
right, rather send tasks to backend services. Threading also adds quite
some complexity hurting single threaded scripts.
- Shorthand functions declaration somehow
for what purpose?
- Get rid of aliased functions
why?
- Basically apply Poka-Yoke principle to the language. There should be
only one way of doing a given action
This is a great goal. Not trivial if one wants to allow evolution.
Please mind: Compatibility is a feature. Not only for past users but
also helps to ensure new users that their investment won't be lost on
the next version. There are tons of legacy code and tons of lines being
created every second which will be legacy a second later. We can break
things where needed, but breaking just to be "cleaner" causes lots of
pain.
johannes
- Native ctype support (no, not the current supported one. Look for its support in Python)
Not an engine feature. feel free to provide an extension API, eventually
might be bundled. (and enabled by default / force)
the ctype equivilent in php would be a more robust and accessible FFI
http://pecl.php.net/package/ffi
I think the goal here would be to expose lib's and be able to
dynamically-ish (program via php) an interface to a library without
having to write an extension.
- With better opcache and ctype, also add better `dl()`, completely removing the need to have so many extensions in core
Better dl is not trivial due to operating system restrictions. With
major refactoring we might improve this a bit, but things which come to
mind cause major breakage in APIs for quite little effect ... I thought
a while about this in regards to composer etc.
I think the idea here is to be able to have per-project extension
dependencies, as you said, with composer. This would be ideal in a way
for the ecosystem to vet extensions before inclusion in core. But
currently, unless you own the system, extensions are extremely
inaccessible to gain any real momentum.
-ralph
I think the idea here is to be able to have per-project extension
dependencies, as you said, with composer. This would be ideal in a way
for the ecosystem to vet extensions before inclusion in core. But
currently, unless you own the system, extensions are extremely
inaccessible to gain any real momentum.
Right, but this isn't a trivial problem. We must ensure that
- extensions load quickly (right now we can have relatively
expensive MINIT code) - extensions survive loading at run time (some extensions, like
session, eventually send HTTP headers, many won't handle
"class/function already defined" errors well) - we don't run into issues in threaded environments (as long
as we support those) - we can properly unload and clean up (some extensions mess with
internal data structures, sometimes the OS has issue with releasing
all symbols etc.) - we don't open too much of a pandorra's box in regards to security
(if we restrict it to extension_dir it is useless for the composer
case, if not we provide a tool to bypass all of PHP's blocking
mechanisms) - ...
I think it is great to do, but a proper solution is not a small project
but might require a revamp of many APIs.
And I want to remind about my typical opinion: We should try to require
as little extensions as possible and do as many things as possible (in a
usable way) in userland. If we spend time on making PHP faster we reduce
the need for extensions even more.
johannes
And I want to remind about my typical opinion: We should try to require
as little extensions as possible and do as many things as possible (in a
usable way) in userland. If we spend time on making PHP faster we reduce
the need for extensions even more.
You're assuming the target implementation is trivial, or even possible.
In non-trivial libraries/implementations, you'll find developers chose
to write their library in c/c++ b/c c and c++ are portable.
Off the top of my head, an example of this would be mapnik. Currently,
no good extension wrapping libmapnik exists, nor is there any spec to
follow that would allow a php developer to replicate the usefulness of
that library in userland php. Moreover, if someone were to be able to
create a userland/1-1 implementation of it, they'd be hard pressed to
keep up with that projects momentum in improving the baseline
implementation in c++.
Another example is the AOP project. Without an extension hijacking the
executor, this kind of extension is not possible in userland in any
meaningful (1st class) kind of way.
I could probably come up with a few more examples, but I think those
suffice.
More to the point though- having the ability to expose portable
libraries to PHP though extensions underscores the "glue" aspect of
PHP's usefulness, it would be beneficial (IMO) to expand this usefulness
to developers.
-ralph
And I want to remind about my typical opinion: We should try to require
as little extensions as possible and do as many things as possible (in a
usable way) in userland. If we spend time on making PHP faster we reduce
the need for extensions even more.You're assuming the target implementation is trivial, or even possible.
I know extensions are needed. Still I think PHP is powerful and often
(often != always) fast enough.
johannes
Let's add my feedback on what seems realistic on what you, Johannes,
nicely pointed out as a "vision" I like a lot, and me not going into
details:
I expect endless discussions on either to pronounce either like in
"ethernet" or as in "I-there", and that for every aspect, artefact,
paradigm, underlying library, language or come what may, with everyone
finally becoming personal, affronting or rude towards the other point
of view.
So, folks, this is how I sum up your list, having read you for a year.
Please, please, please do it differently, which would be both kind and
nice and see that you actually can do better.
Nils (moving forward to Java, more and more)
2014-02-17 23:18 GMT+01:00 Johannes Schlüter johannes@schlueters.de:
And I want to remind about my typical opinion: We should try to require
as little extensions as possible and do as many things as possible (in a
usable way) in userland. If we spend time on making PHP faster we reduce
the need for extensions even more.You're assuming the target implementation is trivial, or even possible.
I know extensions are needed. Still I think PHP is powerful and often
(often != always) fast enough.johannes
You're assuming the target implementation is trivial, or even possible.
I know extensions are needed. Still I think PHP is powerful and often
(often != always) fast enough.
You're right for sure. By and large, the argument of the extension vs.
userland debate is far less technical and more social/cost-benfit driven
than anything else. PHP itself could change some very minor technical
details in the engine (like enabling dl()
for example), that would
completely shift the way people build and manage projects (and their
dependencies).
-ralph
You're assuming the target implementation is trivial, or even possible.
I know extensions are needed. Still I think PHP is powerful and
often (often != always) fast enough.You're right for sure. By and large, the argument of the extension
vs.
userland debate is far less technical and more social/cost-benfit
driven than anything else. PHP itself could change some very minor
technical details in the engine (like enablingdl()
for example), that
would completely shift the way people build and manage projects (and
their dependencies).
This is not a minor thing. My initial mail in this sub-thread listed
the pure minimum of things to solve. dl()
is useless if PHP crashes on
following requests as an extension didn't clean up while unloading or
loading fails as the operating system didn't clean up fully.
Yes, dl()
right now won't directly break with some extensions on some
operating systems ... but there are too many fragile pieces for serious
production use - that's why we limited dl()
.
If there is somebody with knowledge about runtime linking, loading and
unloading they are very welcome to see how to make it stable and where
to limit PHP internal API. I'd love to get rid of global pecl installs
but its unfortunately not a "minor technical detail"... hrm thinking
about deployments etc. I think it is even more complicated as we'd have
to define a clean stable API else upgrading etc becomes a mess ...
johannes
On Feb 19, 2014 12:36 AM, "Johannes Schlüter" johannes@schlueters.de
wrote:
. I think it is even more complicated as we'd have
to define a clean stable API else upgrading etc becomes a mess ...
I totally agree here. It is useful only on CLI while even there it is
disputable as one can use -d easily.
Cheers,
Pierre
Ralph Schindler wrote:
I know extensions are needed. Still I think PHP is powerful and often
(often != always) fast enough.You're right for sure. By and large, the argument of the extension vs. userland
debate is far less technical and more social/cost-benfit driven than anything else.
That PHP supports the range of platforms that it does with the flexibility that
it does creates it's own problems?
Many users will never have even looked at how their PHP is provided, so a single
executable over individual modules is academic. It is probably also mixed up
with the 'compile' verses 'run script' debate? Either way,a hosted PHP
environment needs to be able to supply all of the extensions that it's client
base needs, but that may well be at the expense of speed? Being able to load
only those extensions a script actually needs may result in a much smaller run
time package? Be that a complied application using dynamic copies of preloaded
extensions, or a cached set of code using a memory resident set of functions?
Extensions are the only way to handle the diverse range of external code that
PHP uses, it is purely how those individual packages are combined that is the
area for debate? Personally I prefer a smaller core than PHP provides by
default, and my own small set of extensions added dynamically. I can add extra
facilities simply be loading an additional extension .ini file and restarting
web/PHP. But I don't believe there be ANY gain in a script being able to only
use those extensions it needs?
One area that would make a lot more sense to me though is the ability to apply
security updates to a specific extension and only roll out that one package
rather than having to wait for the whole PHP distribution to be updated? Linux
distributions sort of do this providing incremental updates, but actually that
is more of a hindrance at times! What is being distributed is not necessarily
the same as the current master code base :(
--
Lester Caine - G8HFL
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk
Extensions are the only way to handle the diverse range of external code that
PHP uses, it is purely how those individual packages are combined that is the
area for debate? Personally I prefer a smaller core than PHP provides by
default, and my own small set of extensions added dynamically.
Making the core smaller isn't easy for users - they suddenly don't have
to are about a single version number anymore but check which version of
which extension makes a feature available, and how that relates to the
core version as core provides infrastructure and extension feature might
use conditionally. It's a question of balance and I think right now we
are in a quite good area.
One area that would make a lot more sense to me though is the ability to apply
security updates to a specific extension and only roll out that one package
rather than having to wait for the whole PHP distribution to be updated? Linux
distributions sort of do this providing incremental updates, but actually that
is more of a hindrance at times! What is being distributed is not necessarily
the same as the current master code base :(
Yes and no. In practice most security issues (not that there are
many ..) are in core areas not an extension, so the core part has to be
updated. Splitting things up again gives more components to handle and
makes update processes more complicated. And in practical terms:
Distributions split up all non-forced extensions ... but they, contrary
to us, have a package dependency system which mostly works and on which
they can build upon.
johannes
Hi Johannes,
Answers inline, but before anything, thanks a lot for spending time in at
least willing to read/answer these suggestions.
On Mon, Feb 17, 2014 at 1:18 PM, Johannes Schlüter
johannes@schlueters.dewrote:
Hi,
My suggestion back in 2011 was to rewrite Zend Engine to accommodate a
few
things that people are considering as must-haves nowadays. Based on
history, each ZE is rewritten after every 5 years (1996 - 2001 for ZE1,
2001 - 2005 for ZE2), which hints we may be in a need to reevaluate
current
code and plan support for next 5 years.ZE2 is not a rewrite. PHP 5.1 or 5.2, not sure, had a completely new
executor,aside from that there mostly were extensions.A couple of things to motivate:
- Native Unicode support
Complicated one, see other threads.
Completely agree. Discussed with Pierre some time ago about possibly fixing
these by using C++ in core and reusing libs such as ICU easily.
- Make opcode cache native
What does that mean? What's the expected benefit over opcache?
It is opcache, which for me is opcode cache. Maybe I use a wrong
terminology, but Pierre already covered what I was meaning on his ideas
page.
- Better garbage collector
In what sense?
Dealing with resources seems to not free all resources, such as PDO
ResultSets, Filesystem, etc.
I never really bothered to track this down, but all issues I've experienced
are related to resources.
Another point I wanted to see covered was the ability to have Strong and
Weak references natively. I know Etienne created the WeakRef PECL extension
~2y ago, but I've never seen any sign of possible integration into core and
re-usability for certain parts/functions that could.
- Add basic support for interceptors (preConstruct, postDestroy,
aroundInvoke)This can be added by extensions if needed.
Completely agree, but that would be extremely hard to use without a clean
way of defining class metadata.
- Operator overloading, allowing things like Comparable interface
No. Please not.
Why not?
Right now we already support some, such as $arrGrouped = $array1 + $array2;
which already provides a nice and clean understanding of code flow. I do
see a variety of usages to classes that could benefit from these.
- Attempt to simplify language operators/keywords/symbols
A part of PHP's design is to have keywords which can be googled for,
short operators, notations make it harder if one stumbles over unknown
constructs. Any precise examples?
I mentioned that before here, but I wrote down an EBNF grammar of PHP and
it is damn scary.
Similarly, other languages are fighting to reduce huge parsing time needed
by simplifying their grammar. One good example was Java EE6 which had ~200
grammar rules and now they're down to ~50. That hugely simplifies the
language and parsing/compiling time.
- Native ctype support (no, not the current supported one. Look for
its
support in Python)Not an engine feature. feel free to provide an extension API, eventually
might be bundled. (and enabled by default / force)
Hm... interesting point. I haven't thought from this perspective, it may be
doable.
Still, I don't see this working smoothly without a good organization of now
root level functions into encapsulated namespaces/classes/functions. I also
would require some work around exceptions too.
So far the only attempt close to this I saw was:
http://pecl.php.net/package/ffi
- With better opcache and ctype, also add better
dl()
, completely
removing the need to have so many extensions in coreBetter dl is not trivial due to operating system restrictions. With
major refactoring we might improve this a bit, but things which come to
mind cause major breakage in APIs for quite little effect ... I thought
a while about this in regards to composer etc.
I'd argue we barely need dl()
if we can make ctype always enable then.
- Remove "global" support
Why?
We're trying to get rid of bad old habits, like register_globals.
I'd include this in the list.
- Errors to exceptions
Complicated one, not all errors we have can a) be recovered and b) are
actual errors. Needs a good concept (see also other thread)
a) UnrecoverableException would fix that
b) FatalErrorException
These ones could be uncatchable and done.
I'm probably not the only one in here trying to push this forward. =)
- Consistent exception messages
Feel free to go through it and propose something, that's quite abstract.
I can try, for sure. But one thing that keeps needling my head when I
mention this is always BC compatibility.
- Scalar type hinting
- Named Parameters
- Annotations
See other threads.
Ya, ya, I know... probably since 2010 =)
- Default class resolution/loading (aka. Native PSR-0 support)
Again nothing related to the engine, if that is implemented in an
internal function for spl or such it might be added. Shouldn't be too
complex (except that user-space implementations are simpler to debug for
users if something goes wrong)
You missed slow in here, that's the actual point of coding internally.
I'd also note that you're completely right and it should be part of SPL,
for example.
- Remove error suppression (@ operator)
Unless error handling is revamped this is needed.
If we address this, my first vote would be to use @ for annotations as part
of other thread's discussion.
- C# style mutators and accessors
See RFC.
Saw it... afaik implementation was not ideal and that was exactly why it
was a tough vote.
Maybe someone with better internals understanding helping it would get
better backing?
- Comparable interface
See other thread.
- Collection, Map, Set, List, Bag
collection is a generic term, not sure what you mean. A PHP array is a
map. We have lists in SPL. A bag (multiset/multimap) can be emulated in
a nested array ... if there is need SPL could be extended.
Collection is a generic term, agreed. you should read it as an interface
here.
Classes should then tie in as long as it respects the interface.
The main point of working on this is exactly to address native support from
part of functions such as array_*.
- Namespace visibility
- Namespace Variables
- Namespace Reflection API
for the later we'd indeed have to refactor the engine in a way to have
more overhead from namespaces. This might also be needed in casethe
others are requested ... might need details.
That is a tough one.
ReflectionAPI: Right now we store class name grouping the namespaces as
string. There's no way, for example to retrieve loaded classes inside of
same namespace. It also have no understanding about "use"s inside of a
namespace. I know this is not available after it gets compiled, but
there're so many headaches (have a look at AnnotationsParser inside of
Doctrine) to get this taken into consideration.
Variables: Private/protected variables and methods/functions... I do see a
lot of work needed around here. We could have a private function inside of
a namespace that could help dealing with an specific operation internally
and not being exposed to everyone.
Visibility: We could, for example, create private or protected classes for
a strategy and have only one public API to execute an operation instead of
"free and open for all".
- Drop optional property/method visibility support (make them
required)Why?
Again, remove old PHP bad habits.
- Polymorphism (aka. method overloading)
Hard to do in a dynamic language in an efficient way. will slow down
each and every function call unless somebody has a good idea. Till then
we prefer extra cost for the implementor in the few times this is
needed.
Because PHP is loosely typed, yes, it would require to traverse/check which
method to call.
Some compilers I wrote in the past century did a trick to resolve at
runtime creating a delegator during compilation.
To simplify resolution, I used a hash table based on argument types to find
the right method.
- Virtual methods
what should this be in the context of PHP? From a C++ sense all PHP
methods are virtual.
That is exactly the point. Everything can be overwritten.
There's no way to enforce a public method that it can't be overloaded by a
subclass.
- pecl_http into core (considering better
dl()
item isn't accepted)might be interesting.
- Previous item would lead to complete removal of superglobals
Why that? To break every single PHP script out there?
Again, let's get rid of bad habits.
- Normalize overall current/future design for the language (why
__toString, __wakeup, __sleep vs. Jsonable or Serializable
interfaces?)any proposal keeping a viable BC way?
This is not an actual clear decision.
Language is far from being consistent, and without agreeing on a single
resolution to a problem leads to more and more confusion. Why is there a
__toString instead of a Stringable? Why is this then valid for Jsonable and
not to __toJson()? Or __clone instead of Cloneable?
That's a resolution that needs to be achieved and agreed by everybody.
- Primitive types (enhance SplInt et al. and make them native, with
actual <type>_* required methods and discard nice to have ones)- Add valuable to these primitive types (oh, and make the default
parameter ordering. Not everyone would love to keep using named
parameters
over and over)- Make native functions support Spl* instances (ie.: substr(new
SplString('foobar'), 0, 3)) as a beginning to remove overall functions
support- "Strict" variable types (relies on previous 2: type hinting, type
inference, type casting, return types. Quotes were added because they
would
be inferred, not declared. That would force assignments to validate
types,
such as $a =1; $a=false; would throw an exception because you're
changing
variable type)See old discussions on type hints etc.
Ya, ya... I know.
- Remove functions from global namespace
Why?
To reduce overhead if you don't need.
Let's assume I have a file that only deals with strings. Why do I need all
array functions in the function hash table if I don't need them?
By organizing them into proper namespaces and also supporting some concept
I mentioned earlier like ctypes, we could significantly reduce memory
footprint.
- Threads support (no, don't tell me about pthreads extension)
for what purpose? We should imo rather focus on async operations. Doing
complex operations in parallel on a loaded web frontend doesn't seem
right, rather send tasks to backend services. Threading also adds quite
some complexity hurting single threaded scripts.
CLI scripts. Not everything done in PHP is web frontend.
I do agree we should also invest time in async support, but threads are not
irrelevant completely.
- Shorthand functions declaration somehow
for what purpose?
Why do I need to write function if its declaration is completely different
from properties?
Why keep function when var is not required?
- Get rid of aliased functions
why?
Again, bad habits.
- Basically apply Poka-Yoke principle to the language. There should be
only one way of doing a given actionThis is a great goal. Not trivial if one wants to allow evolution.
Please mind: Compatibility is a feature. Not only for past users but
also helps to ensure new users that their investment won't be lost on
the next version. There are tons of legacy code and tons of lines being
created every second which will be legacy a second later. We can break
things where needed, but breaking just to be "cleaner" causes lots of
pain.
Piling up tons of compatibility since PHP 4 only makes things harder and
harder to evolve.
Sometimes we need to break BC. One step back, 100 forward.
I agree that there're tons of legacy code. I work on massive ones too dated
over 10yrs. This doesn't mean language can't move forward because of them.
Of course BC breaks should be carefully planned. I think PHP6 is a good
point in PHP's lifetime to group all BC breakages ever considered and done
in a single shot.
johannes
--
Guilherme Blanco
MSN: guilhermeblanco@hotmail.com
GTalk: guilhermeblanco
Toronto - ON/Canada
Hi,
picking just a few topics out of the list:
(not that I agree with the others, but they'd need more detailed
proposals before one can properly argue)
- Operator overloading, allowing things like Comparable interface
No. Please not.
Why not?
Right now we already support some, such as $arrGrouped = $array1 + $array2;
which already provides a nice and clean understanding of code flow. I do
see a variety of usages to classes that could benefit from these.
Even though we add more and more "type hints" we are still a dynamically
typed language, operator overloading brings little syntactic sugar for
loss of clarity.
btw. I'm probably the one who implemented operator overloading first in
PHP:
http://devzone.zend.com/299/zend-weekly-summaries-issue-222/#Heading2
Sarah has an (probably outdated) extension. pecl.php.net/operator
- Remove "global" support
Why?
We're trying to get rid of bad old habits, like register_globals.
I'd include this in the list.
register_globals easily caused security issues which are hard to find,
"global" might generate "bad quality code" but is easy to find.
And, believe it or not, there are many instances where PHP is actually
used for quite short scripts. There it can be neat. I see little reason
to remove it for purism.
- Errors to exceptions
Complicated one, not all errors we have can a) be recovered and b) are
actual errors. Needs a good concept (see also other thread)a) UnrecoverableException would fix that
b) FatalErrorExceptionThese ones could be uncatchable and done.
I'm probably not the only one in here trying to push this forward. =)
There is another thread on error handling and I'd like to get things
cleared but what'd I'd i.e. like is some more logging style error
reporting,there are cases where execution can continue flawlessly but
the user should be noted, right now the only tool we have is E_NOTICE.
Any exception is too much.
- Default class resolution/loading (aka. Native PSR-0 support)
Again nothing related to the engine, if that is implemented in an
internal function for spl or such it might be added. Shouldn't be too
complex (except that user-space implementations are simpler to debug for
users if something goes wrong)You missed slow in here, that's the actual point of coding internally.
I'd also note that you're completely right and it should be part of SPL,
for example.
Is the performance issue truly in code execution, not in IO operations
while searching the file? (I never benchmarked it)
- Remove error suppression (@ operator)
Unless error handling is revamped this is needed.
If we address this, my first vote would be to use @ for annotations as part
of other thread's discussion.
We can't drop an operator and immediately use it for something else this
will freak out all tools and users. We can deprecate it over sometime
then let people forget about it and then reintroduce with new usage,
this takes a few years, though.
And still the requirement is to replace full error handling first. With
current error mechanisms there is no way to open an external resource
and manually handle the error.
- Collection, Map, Set, List, Bag
collection is a generic term, not sure what you mean. A PHP array is a
map. We have lists in SPL. A bag (multiset/multimap) can be emulated in
a nested array ... if there is need SPL could be extended.Collection is a generic term, agreed. you should read it as an interface
here.
Classes should then tie in as long as it respects the interface.
The main point of working on this is exactly to address native support from
part of functions such as array_*.
This an certainly be improved, not that arbitrary conatainers could ever
be used with any array funtion ... not all allow all kinds of access and
cases where new containers are created (anything creating subsets etc.)
are tough to do truly in a generic way. Even C++ which isone of the most
advanced languages forgeneric programming can't do that for alot of STL
containers and operation
- Namespace visibility
- Namespace Variables
- Namespace Reflection API
for the later we'd indeed have to refactor the engine in a way to have
more overhead from namespaces. This might also be needed in casethe
others are requested ... might need details.That is a tough one.
ReflectionAPI: Right now we store class name grouping the namespaces as
string. There's no way, for example to retrieve loaded classes inside of
same namespace. It also have no understanding about "use"s inside of a
namespace. I know this is not available after it gets compiled, but
there're so many headaches (have a look at AnnotationsParser inside of
Doctrine) to get this taken into consideration.
Variables: Private/protected variables and methods/functions... I do see a
lot of work needed around here. We could have a private function inside of
a namespace that could help dealing with an specific operation internally
and not being exposed to everyone.
Visibility: We could, for example, create private or protected classes for
a strategy and have only one public API to execute an operation instead of
"free and open for all".
All possible, like always: needs a good proposal, implementation and
evaluation of costs vs benefit. Storing more meta information in memory
increases memory usage, reduces available memory per PHP process, uses
more time to parse and cleanup etc.
I' open for ideas.
- Drop optional property/method visibility support (make them
required)Why?
Again, remove old PHP bad habits.
See comment on global above.
- Polymorphism (aka. method overloading)
Hard to do in a dynamic language in an efficient way. will slow down
each and every function call unless somebody has a good idea. Till then
we prefer extra cost for the implementor in the few times this is
needed.Because PHP is loosely typed, yes, it would require to traverse/check which
method to call.
Some compilers I wrote in the past century did a trick to resolve at
runtime creating a delegator during compilation.
To simplify resolution, I used a hash table based on argument types to find
the right method.
Mind that function calls in PHP are already quite slow (and as they are
a key operation they always will be too slow till we have full inlining
+jit :-) ) each thing we add there, each branch we add, each time the
CPUs branch predictor goes wrong sums up to notable effects in that
area.
- Virtual methods
what should this be in the context of PHP? From a C++ sense all PHP
methods are virtual.That is exactly the point. Everything can be overwritten.
There's no way to enforce a public method that it can't be overloaded by a
subclass.
We have final.
- Previous item would lead to complete removal of superglobals
Why that? To break every single PHP script out there?
Again, let's get rid of bad habits.
See comment on global
- Normalize overall current/future design for the language (why
__toString, __wakeup, __sleep vs. Jsonable or Serializable
interfaces?)any proposal keeping a viable BC way?
This is not an actual clear decision.
Language is far from being consistent, and without agreeing on a single
resolution to a problem leads to more and more confusion. Why is there a
__toString instead of a Stringable? Why is this then valid for Jsonable and
not to __toJson()? Or __clone instead of Cloneable?
That's a resolution that needs to be achieved and agreed by everybody.
And that starts with a good proposal ;)
- Remove functions from global namespace
Why?
To reduce overhead if you don't need.
Let's assume I have a file that only deals with strings. Why do I need all
array functions in the function hash table if I don't need them?
By organizing them into proper namespaces and also supporting some concept
I mentioned earlier like ctypes, we could significantly reduce memory
footprint.
I don't see how multiple tables and a more complex lookup saves
something maybe I don#t understand something without proper RFC :-)
- Threads support (no, don't tell me about pthreads extension)
for what purpose? We should imo rather focus on async operations. Doing
complex operations in parallel on a loaded web frontend doesn't seem
right, rather send tasks to backend services. Threading also adds quite
some complexity hurting single threaded scripts.CLI scripts. Not everything done in PHP is web frontend.
I do agree we should also invest time in async support, but threads are not
irrelevant completely.
Issue with allowing thread support is that everything has to be aware of
the existence. We punish everybody for a small benefit in few cases? PHP
isn't the only language in the world. PHP's purpose is "solving the web
problem".
- Shorthand functions declaration somehow
for what purpose?
Why do I need to write function if its declaration is completely different
from properties?
This was discussed on my proposal before
https://wiki.php.net/rfc/optional-t-function
Conclusion was that many people love doing grep function
. As said in
my initial mail in this thread: PHP is designed to have googleable
keywords.
Why keep function when var is not required?
Variable declarations don't tell anything in PHP, you can leave them out
completely. Function declarations have to be looked up to understand
things. And no, "use an IDE" is not an answer - 'git grep' is nice to
search through a projects history, and when hunting for bugs in
customer's code I don't want to fire up an IDE when only havin rmeote
access.
- Get rid of aliased functions
why?
Again, bad habits.
see above. ;-)
Piling up tons of compatibility since PHP 4 only makes things harder and
harder to evolve.
Sometimes we need to break BC. One step back, 100 forward.
I agree that there're tons of legacy code. I work on massive ones too dated
over 10yrs. This doesn't mean language can't move forward because of them.Of course BC breaks should be carefully planned. I think PHP6 is a good
point in PHP's lifetime to group all BC breakages ever considered and done
in a single shot.
I agree that we need to break from time to time. But see the PHP 4 to
PHP 5 adoption where the only notable break was by-refvs. by-value
behavior of objects. It took years till PHP 5 had adoption. (and no, I
won't mention Python 3 or Perl 6 "success" ;) )
Successful evolution has to come with a clear purpose and is along term
process, see i.e. register_globals which took from 4.2 in 2002 were
super globals were introduced till 5.4 2012 where register_globals was
finally removed. 10 years.
PHP has a massive install base and most systems receive only minimal
maintenance. In many places the original developers left and only some
operations person is keeping it up ...
johannes
Q
0
Sendt fra min iPhone
Den 17/02/2014 kl. 18.08 skrev "guilhermeblanco@gmail.com" guilhermeblanco@gmail.com:
We could all look of what users are willing for too... there was a thread
on Reddit about it.
Here was my comment:
http://www.reddit.com/r/PHP/comments/1iw0cj/what_would_you_change_about_php_if_you_could/cb9rzw4Here is the comment for lazy readers.
My suggestion back in 2011 was to rewrite Zend Engine to accommodate a few
things that people are considering as must-haves nowadays. Based on
history, each ZE is rewritten after every 5 years (1996 - 2001 for ZE1,
2001 - 2005 for ZE2), which hints we may be in a need to reevaluate current
code and plan support for next 5 years.A couple of things to motivate:
- Native Unicode support
- Make opcode cache native
- Better garbage collector
- Add basic support for interceptors (preConstruct, postDestroy,
aroundInvoke)- Operator overloading, allowing things like Comparable interface
- Attempt to simplify language operators/keywords/symbols
- Native ctype support (no, not the current supported one. Look for its
support in Python)- With better opcache and ctype, also add better
dl()
, completely
removing the need to have so many extensions in core- Remove "global" support
- Errors to exceptions
- Consistent exception messages
- Scalar type hinting
- Named Parameters
- Annotations
- Default class resolution/loading (aka. Native PSR-0 support)
- Remove error suppression (@ operator)
- C# style mutators and accessors
- Comparable interface
- Collection, Map, Set, List, Bag
- Namespace visibility
- Namespace Variables
- Namespace Reflection API
- Drop optional property/method visibility support (make them required)
- Polymorphism (aka. method overloading)
- Virtual methods
- pecl_http into core (considering better
dl()
item isn't accepted)- Previous item would lead to complete removal of superglobals
- Normalize overall current/future design for the language (why
__toString, __wakeup, __sleep vs. Jsonable or Serializable interfaces?)- Primitive types (enhance SplInt et al. and make them native, with
actual <type>_* required methods and discard nice to have ones)- Add valuable to these primitive types (oh, and make the default
parameter ordering. Not everyone would love to keep using named parameters
over and over)- Make native functions support Spl* instances (ie.: substr(new
SplString('foobar'), 0, 3)) as a beginning to remove overall functions
support- "Strict" variable types (relies on previous 2: type hinting, type
inference, type casting, return types. Quotes were added because they would
be inferred, not declared. That would force assignments to validate types,
such as $a =1; $a=false; would throw an exception because you're changing
variable type)- Remove functions from global namespace
- Threads support (no, don't tell me about pthreads extension)
- Shorthand functions declaration somehow
- Get rid of aliased functions
- Basically apply Poka-Yoke principle to the language. There should be
only one way of doing a given actionHm... I think that's enough for now! =)
Cheers,
Before opening a new thread about JIT, I have one simple question.
The wiki page created by Pierre talks about LibJIT. This library has an
integrated interpreter (for platforms where JIT is not available). I don't
know anything about the speed of this interpreter, but maybe it could be
interresting to evaluate it as the lone interpreter in the PHP engine. Is
anyone thinked about that?2014-02-17 7:28 GMT+01:00 Pierre Joye pierre.php@gmail.com:
hi,
I put my thoughts and summary of the recent discussions about what
could be PHP 6 here:https://wiki.php.net/ideas/php6
Things like "we should name it php7" has not been covered, for one
obvious reasons.It is not a TODO list but a list of proposals I would like to see us
discuss, work on, push harder. They are features, changes, etc. I have
been hearing for years and things we should really give more
attention.Please do not mass reply to this thread but prefer to create one new
thread per topic. Who knows, we may get enough input to create one
wiki page per topic. And if you are lucky enough, we may even have
some working groups for each of them?Happy reading, comments, feedback and the likes welcome!
Cheers,
Pierre
@pierrejoye | http://www.libgd.org
--
--
Guilherme Blanco
MSN: guilhermeblanco@hotmail.com
GTalk: guilhermeblanco
Toronto - ON/Canada
Little reminder:
Please do not mass reply to this thread but prefer to create one new
thread per topic.
It is critical to keep this discussion manageable.
Also some topics have been discussed or even voted on in the past but
things evolve and change. Annotation is one of the good examples. As
some voted against back then, they rely on them now in their
fraweworks. I very strongly suggest not to reply with one liner like
"no, see archive" as it will not bring us any closer to a sane
discussion (and decisions).
Cheers,
Pierre
@pierrejoye | http://www.libgd.org