In order to try to organize a little better the original purpose of the
discussion I started, I decided to "rename" this subject to something
closer to the purpose. From "experimental features" to "feature preview".

Original thread: https://marc.info/?l=php-internals&m=166491585711553

These are my suggestions, as per the discussion that took place during the
original thread.

(A) What are preview features:

(A1) There are features ALREADY 100% APPROVED through the voting system
among the PHP team and that can already be implemented in the language in a
preview format (via PR), available to the general public through
minor/patch releases through "preview" markers.

(A2) These are features that are understood to be effective for the
language and that will be available in a future major (eg. 9.0) or minor
release (eg. 8.2). That is, it is not intended to be removed "at any time".

(B) What are NOT preview features:

(B1) Suggested features, even if well accepted during discussions, but not
passed the voting process as approved, even if a PR is already available.

(B2) Experimental features (literal), whose idea would be to test "in
practice" its functionality before deciding if it will be part of the
language or not.

(B3) Features that may have a high risk of rejection due to performance,
security or usability issues, even if they were approved during
voting. That is: when in doubt, even if approved, keep it as exclusive to
the next release.

(B4) New features approved but with pending discussion should not be
previewable. For example: json_validate() is approved, but the function
name is under discussion whether is_json_valid() or json_validate() is
better. In this case, it prefers to keep it out of the preview until that
is decided.

(C) What changes in the voting process:

(C1) An additional voting topic to decide whether a new feature can be
previewed or not (i.e. basically deciding whether the feature is safe to
test ahead of time, taking security primarily into account).

(C2) Additionally, decide what the target version of PHP will be (eg. PHP
8.2? 8.3? 9.0?). This helps more complex features get more preview and
feedback time.

(D) Advantages:

(D1) New features will be able to be tested before an official release (eg.
8.2), and all issues can be resolved before this release.

(D2) During the voting process, a feature can be developed for the next
version (eg. 8.2) or postponed to the next-next version (eg. 8.3), if it
encounters difficulties, without freezing/delaying the release of version
8.2, for example.

(D3) Regular users will be able to test features in preview, without
installing nothing (eg. PECL), since they will be available natively in
PHP. Of course, with the notion of the impacts such features can have (like
needing to use markers, minimal performance issues). It is important that
the documentation makes it clear that a particular feature is under
development in preview mode.

(D4) The development team will have early feedback on these features, and
will be able to work on fixes with more "peace of mind" and security, since
there will be no obligation to release a patch that quickly (except for
security issues).

(E) Disadvantages:

(E1) The development team will have to pay attention to early feedback for
a feature still in preview. However, this is something that would happen
after the final version anyway. In practice, I imagine the time used would
be equivalent.

(E2) Once the final version is released, the language would have to accept
some markers temporarily and deprecate-notice them until it is sure that
users have migrated to the final version. Probably these markers should be
permanently removed at the next major or major+1.

(E3) Users using preview features should be responsible for updating the
code as soon as the final version becomes available.

(F) Final considerations:

(F1) Preview features need markers, either in the function (eg.
preview_json_validate() or maybe Preview\json_validate()), in new classes
(eg. Preview\XYZ::method()), in new methods (eg. XYZ::preview_method()) or,
if affect the language itself, in declarations (eg. declare(preview_xyz =
1)).

(F2) Preview features can only be removed when there is a serious security
risk to the language that is irreparable. By way of comparison, removing a
preview feature is like, after releasing PHP 8.2, dropping support for
"readonly" as class modifier. That is, it is understood that it must be
thought of as something unfeasible and impossible to happen.

(F3) Preview features can be started in PHP 8.1, for example, and made
final in PHP 8.2, 8.3, 8.4 or 9.0, and so on, as long as this is decided
during the vote.

(F4) We can try a single preview feature. Instead of thinking that
"features in preview" should become a default for PHP now, in a definitive
way, we can opt for a new feature approved in PHP 8.3 (currently I don't
think there is any approved, but eventually we will), for example, and make
it available in PHP 8.2 as preview. So we test in practice whether the idea
itself will work or not (and even user adherence, with open source projects
and feedback). And if all goes well, we can make it default for PHP to
offer this kind of support. If something goes wrong, we can let this idea
go.

(F5) Preview features should generally be released in patch versions (eg.
PHP 8.1.12 to preview a PHP 8.2 feature).



Atenciosamente,
David Rodrigues

Reply via email to