Closed thekid closed 8 years ago
Places using xp::null()
:
$ grep -Hirn xp::null src/main/|cut -d ':' -f 1|sort|uniq
src/main/php/lang.base.php
src/main/php/lang/ClassLoader.class.php
src/main/php/lang/Process.class.php
src/main/php/lang/Wildcard.class.php
src/main/php/lang/XPClass.class.php
src/main/php/unittest/TestResult.class.php
src/main/php/unittest/web/WebTestCase.class.php
src/main/php/util/CompositeProperties.class.php
src/main/php/util/Filters.class.php
src/main/php/util/cmd/Console.class.php
Places using xp::error()
:
$ grep -Hirn xp::error src/main/|cut -d ':' -f 1|sort|uniq
src/main/jay/webservices/json/json.jay
src/main/php/io/File.class.php
src/main/php/io/ZipFile.class.php
src/main/php/lang.base.php
src/main/php/lang/types/Character.class.php
src/main/php/lang/types/String.class.php
src/main/php/util/Hashmap.class.php
_The core functionality raise
is now deprecated in 6.1.0 and will be removed in 6.4.0._ The original idea to introduce it was to only load exceptions raised in seldomly executed code paths lazily. With namespaces, this is always the case. Thus, the function has become obsolete.
_The uses
statement is now deprecated in 6.1.0 and will be removed in 6.4.0._ This means also classes in the global namespace which are aliased to fully qualified names as well as package classes from RFC #37 are considered deprecated.
The above plan states XP 6.6.0 will require PHP 5.6 as its minimum version. This was chosen instead of PHP 5.5 for the following reasons:
PHP 5.6 was originally released in late August 2014. By the time XP 6.6.0 is released:
HHVM 3.5.0 matches PHP 5.6 - see http://3v4l.org/s50F2#vhhvm-341
On top of the following XP-relevant PHP features in PHP 5.5
T::class
- replaces string references to classes....it also supports:
...and contains a fix for PHP bug #66608 (Incorrect behavior with nested "finally" blocks).
_The core functionality delete
is now deprecated in 6.2.0 and will be removed in 6.5.0_. Simply use the language construct unset
instead, which also accepts variadics.
_The core functionality xp::null()
is now deprecated in 6.2.0 and will be removed in 6.6.0._. If you need null
-safe handling, you can use the cast()
core functionality or the ?:
operator.
$ xp -w '$period= ...; return cast($period->endDate(), "util.Date")'
Uncaught exception: Exception lang.ClassCastException (Cannot cast NULL to util.Date)
# ...
$ xp -w '$period= ...; return $period->endDate() ?: Date::now()'
2015-04-25 13:55:47+0200
Criticism on the Optional
class in Java:
Maybe we should think about this a bit more before introducing it to the framework
On renaming the wrapper types (see the reserving more types and reserving even more types RFCs, the following are now all reserved:
int, float, bool, string, true, false, null, resource, object, scalar, mixed, numeric
Since class names in PHP are case insensitive this means we'll to rename some prominent classes in the XP Framework:
Primitive
class provides methods for boxing and unboxing. These will also be deprecated and removed: wrapperClasss(), unboxed(), boxed()
.By removing the class aliasing for lang.types.* in lang.base.php and the wrapperClasss(), unboxed(), boxed() methods from Primitive, the sequence library runs once again with PHP 7:
Timm@slate ~/devel/xp/sequence [master]
$ XP_RT=7.0 unittest src/test/php/
# ...
✓: 496/496 run (0 skipped), 496 succeeded, 0 failed
Memory used: 3090.66 kB (3409.80 kB peak)
Time taken: 0.037 seconds
The "Object" name has not been reserved yet, though.
_The wrapper types in lang.types , primitive boxing and unboxing are now deprecated in 6.3.0_. The new wrapper type library is https://github.com/xp-forge/wrappers
_The core functionality xp::nameOf() is now deprecated in 6.3.0 and will be removed in 6.6.0._ Simply use the new nameof()
instead.
Following PHP7's first alpha - see http://php.net/archive/2015.php#id2015-01-11-6 - we've created a release which passes all tests but those where it's clear we won't have compatibility, like with the String
and Float
wrapper types:
https://github.com/xp-framework/core/releases/tag/v6.3.1
Please note the XP6 series will not support PHP7 officially: It reserves the name object , which clashes with our root class lang.Object . However, PHP7 alpha 1 does not yet raise an error if this class name is used.
These SDK parts support PHP7:
The first libraries to support PHP7 are:
All of them allow failures for PHP 7 as long as it's not final yet.
_The pre-namespace class loading is no longer supported in 6.4.0_. No more uses(), now more support for package-qualified and global namespace classes as fully qualified class names.
See xp-framework/core#88
_The raise() core function is longer supported in 6.4.0_. It was related to pre-namespace class loading, lazily loads exception and then throws it. No longer necessary now that we are using the PHP builtin class loading, which is lazy by default.
See xp-framework/core#89
_The core functionality create() can now only be used to create generics in 6.4.0_. The second usecase, create(new T())->method()
is replaced by PHP 5.4's syntactic support for (new T())->method()
.
See xp-framework/core#91
The wrapper type library has its first release, 0.1.0. In it:
package lang.types {
public abstract class lang.types.Num
public final class lang.types.Int8 // "Byte", -128 to 127
public final class lang.types.Int16 // "Short", -32768 to 32767
public final class lang.types.Int32 // "Int", -2^31 to (2^31)- 1
public final class lang.types.Int64 // "Long", -2^63 to (2^63)- 1
public final class lang.types.Single // "Float", -3.4 x 10^38 to +3.4 x 10^38
public final class lang.types.Double // "Double", ±5.0 x 10^324 to ±1.7 x 10^308
public final class lang.types.Str // "String"
}
The reflection replacement library has now reached 1.0.0, fully supporting:
_Heads up: XP 6.5.0 will require PHP 5.5.0 minimum!_ Unofficially (meaning: tests will no longer verify its functionality), XP 6.5.0 will still run on PHP 5.4.X, as none of the code in src/main uses PHP 5.5 features yet, but do upgrade!
See xp-framework/core#97 and xp-framework/core#98
_The delete()
core function is longer supported in 6.5.0._ It can be replaced by using the language construct unset
.
_The ensure()
core functionality is deprecated in 6.5.0._ It can be replaced by the PHP 5.5 language construct finally
:
Before
try {
$file->write(...);
} catch (\lang\Throwable $e) {
// Empty
} ensure($e); {
$file->close();
if ($e) throw $e;
}
|
After
try {
$file->write(...);
} finally {
$file->close();
}
|
Before
try {
$file->write(...);
} catch (\lang\Throwable $e) {
$cat->warn('Could not write to file');
} ensure($e); {
$file->close();
if ($e) throw $e;
}
|
After
try {
$file->write(...);
} catch (\lang\Throwable $e) {
$cat->warn('Could not write to file');
throw $e;
} finally {
$file->close();
}
|
_You are encouraged to use ::class
for newinstance() and in annotations as of XP 6.5.0_. Instead of providing the class name in dotted form, import via use
and then use PHP's native name resolution.
$instance= newinstance(Runnable::class, [], [
'run' => function() { ... }
]);
#[@test, @expect(IllegalArgumentException::class)]
public function negative_test() {
// ...
}
_The this() core function is longer supported in 6.6.0_. It's been obsoleted by syntactic support in PHP:
// Before
$first= this($class->getMethods(), 0);
// After
$first= $class->getMethods()[0];
See https://wiki.php.net/rfc/functionarraydereferencing (implemented in PHP 5.4).
_The xp::error() core function is longer supported in 6.6.0_. Replace by throwing exceptions in the spirit of PHP 7, which has done away with most fatal errors.
See https://wiki.php.net/rfc/catchable-call-to-member-of-non-object and https://wiki.php.net/rfc/engine_exceptions_for_php7
_The xp::null() core function is longer supported in 6.6.0._. Replace by the "real" null
(and then check for it) or use the sequence library's Optional
class.
_The xp::nameOf() core function is longer supported in 6.6.0_ and has been superseded by nameof($instance)
.
_The util.collections package is deprecated in 6.6.0_. It has been extracted from core. Its development will continue inside https://github.com/xp-framework/collections
XP 6.6.0 has been released
_Quite a bunch of APIs are deprecated (but not removed) in XP 6.7.0_ and have been extracted. This means development will continue in the separate places, and the code will be removed from XP core in 7.0.0.
The relevant changelog entry:
peer.*
APIs to its own package and deprecated the
one inside core. See https://github.com/xp-framework/networkingmath
API to its own package and deprecated the
one inside core. See https://github.com/xp-framework/mathtext
API to its own package and deprecated the
one inside core. Split into:
. https://github.com/xp-framework/tokenize
. https://github.com/xp-framework/patterns
. https://github.com/xp-framework/text-encodesecurity
API to its own package and deprecated the
one inside core. See https://github.com/xp-framework/securityxp::reflect() has been deprecated since September 2014, and can be replaced seamlessly by literal()
.
These places need to be fixed:
XP 6.7.0 has been released
Now that PHP7 is out on the one hand and we're getting quite close to the final stripped down stadium of XP core, we could create a branch in xp-framework/core and start development on the 7.X code base.
:fast_forward: https://github.com/thekid/core/tree/seven
XP 6.8.0 has been released
:warning: There most probably will no longer be a remote
library when XP7 comes out, see XP RFC 0304
XP 6.9.0 has been released
XP 6.10.0 has been released. It contains support for RFC-303 style runners, which bring a new "TL;DR" style for usage messages:
One of the next steps will be to switch branches:
_Master of xp-framework/core is now at 7.0.0-dev_
:white_check_mark: Changed all libraries to use nameof()
instead of getClassName()
, see https://github.com/xp-framework/core/pull/120
Interesting PHP 7.1 feature: The void
return type: https://wiki.php.net/rfc/void_return_type
_Other than https://github.com/xp-framework/core/pull/57, I think we're all set for XP7_ - need to decide whether this should go in or not.
Decided to implement basic hack language support in https://github.com/xp-framework/core/pull/123 (see also #308)
XP 7 -> PHP 7
I decided against this after finding out Debian wasn't going to provide PHP 7 until 2017. Lots of production systems inside companies are just making the step towards jessie, which gives us PHP 5.6 (/cc @kiesel @mikey179)
We need to remove reflection from the core (-> library)
This has not happened. I decided to leave this in until XP8, as the mirrors
library isn't breaking any speed records, and I haven't succeeded in fixing this yet.
We need to remove process control and threading from the core (-> library)
I haven't felt this is necessary after all, also moving this until a later release.
Think about need for generics and create()
At the moment, there are still some libraries benefiting from generics, so I decided to keep them. It remains to be seen whether e.g. xp-forge/partial has the potential to replace them. Maybe something similar to Hack's type constants?
Coming from XP 6.0, and migrating to current XP 6-master as preparation for XP 7, here's the list of removed core functionality
Scope of Change
This RFC describes the path towards XP 7.0
Rationale
Multiple big changes will be introduced. This document holds the roadmap; and what migrations will be necessary when.
Functionality
What needs to change
$instance->getClass()
can be replaced bytypeof($instance)
we need to introduce a shortcut for$instance->getClassName()
as core functionalitynameof()
.null
class and xp::null()uses()
completelyRoadmap
uses()
andraise()
, Libraries: Introduce new better reflection API (https://github.com/xp-forge/mirrors)think about introducing*util.Optional
(from https://github.com/xp-forge/sequence)remote
orrdbms
uses()
andraise()
, now supports namespace-only classes, deprecate usingcreate()
for anything other than generics, deprecatethis()
, long array syntax in both annotations and codedelete()
. Deprecateensure()
which is replaced byfinally
. Libraries: Unittests and logging will be extracted (see RFC #293 and RFC #301).this()
, xp::error() (the latter is not commonly used and can be replaced by exceptions). Libraries: Extract collections libraryseven
branch, refactor code to work without extracted APIs, forward compatible adjustments, cleanupensure()
.Security considerations
Speed impact
Dependencies
Related documents