- 
        Couldn't load subscription status. 
- Fork 1
Description
Scope of Change
In PHP 7, type hinting has introduced "string", "int", "double", "bool", "object", "resource" etc. as type names. Since PHP's class names are case-insensitive, and to prevent ambiguity, classes are not allowed to be named like this, neither in global scope nor inside a namespace. The XP Framework will need to adapt to this change.
Rationale
Functionality
The conflicting classes are:
The core class null
Inside lang.base.php, there's a class "null" which is used for the "safe" fatal error which raises exceptions. Since PHP 7 has recoverable errors for this and there's also the null coalesce operator ??, we suggest to remove this functionality entirely.
Our base class lang.Object
All of the XP Framework's classes are guaranteed to implement the lang.Generic interface so we can easily type-hint we're expecting any XP object here on the one side, and at the same time rely on things like hashCode(), equals(), getClass() and toString(). This can easily be done by extending the base class lang.Object.
Here are the options:
-  Rename base class to something different, e.g. lang.Val.. People would simply rewrite theirextendsstatement by global search/replace (we could provide a tool for this). Including class aliasing to provide forward-compatibility, this is probably the less obtrusive change,
-  Remove base class and provide a trait lang.Val. Same as above, thoughclass X extends Object { ... }would be replaced byclass X implements Generic { use Val; ...}. This might have a bad effect memory-wise due to trait's inner working.
-  Rewrite methods to core functions and __compare()/__hashcode()/...-style callback magic inside classes for overwriting. This is the PHP-way, and would also raise interop with other frameworks, but have a negative performance impact (method_exists vs. instanceof).
-  Add a lang.Valueinterface with toString(), hashCode() and compareTo() methods. The latter supersedes equals(). See https://wiki.php.net/rfc/comparable
Type wrappers
There are various problems with the lang.types package:
package lang.types {
  // These directly clash
  public class lang.types.Float
  public class lang.types.String
  // These are aliases and might be problematic in the future
  public class lang.types.Double
  public class lang.types.Integer
  public class lang.types.Boolean
  // These are "safe" for the moment:
  public abstract class lang.types.Number
  public class lang.types.ArrayList
  public class lang.types.ArrayMap
  public class lang.types.Byte
  public class lang.types.Bytes
  public class lang.types.Character
  public class lang.types.Long
  public class lang.types.Short
}Following RFC #296 the entire type wrapper package will be extracted. An alternate package if necessary can chose to come up with e.g. prefixed or suffixed names (e.g. "FloatNum") and a changed API (like "StringBuffer", which is no longer immutable).