News

5.8 Feature showcase: Accessing class interna

at 2010-08-30 in Examples5.8-SERIES by friebe

NeoThe XP Framework's 5.8-SERIES contains a feature that will allow the reflection API to access private and protected members. Of course, just because you can, doesn't mean you should, as this does allow you to break the encapsulation principle.

On the other side, this feature comes in handy for serialization mechanisms, as well as for reflection-based factory or delegation patterns.


(more)

5.8.0RC2: The second pre-release of the upcoming 5.8-SERIES

at 2010-08-29 in ReleasesAnnouncements5.8-SERIES by friebe

The XP group is proud to announce the immediate availabality of 5.8.0, release candidate #2. On top of the features contained in RC1, the following have been implemented:

Plus, all the recent fixes applied to 5.7.11-dev have been merged, most notably the generics fix for equals().

You can grab a release as always by using our setup routine:
  $ cd ~/xp
$ wget http://releases.xp-framework.net/setup/5.8.0RC2 -O - | php -- -d ~/bin/
...to give it a test run. Enjoy:-)



Y2K38

at 2010-08-25 in Further reading by friebe

In a recent Sitepoint article, the author talks about problems with PHP's strtotime() function, which can be basically summed up to this:

  $ xp -e 'Console::writeLine(date("l d F Y H:i", strtotime("2040-02-01")));'
Thursday 01 January 1970 01:00
The problem is the internal representation of dates, which will overflow and thus cause strtotime() to yield an incorrect value.

The XP Framework's util.Date class, being based on PHP's DateTime class, will not exhibit this problem, regardless of whether the system is 32-bit or 64-bit.
<?php 
$d= new Date('2040-02-01');
Console::writeLine
($d->toString('l d F Y H:i')); // Wednesday 01 February 2040 00:00
?>
See also http://en.wikipedia.org/wiki/Year_2038_problem and - with a humouristic take: http://xkcd.com/607/



Workaround for Socket::canRead() failing with PHP's VC9 binaries

at 2010-08-23 in Announcements by friebe

A workaround was added to the peer.Socket class which fixes up this method raising exceptions although the underlying select() call succeeded. This occurres when PHP's VC9 binaries are used - the native function will issue a warning "Invalid CRT parameters detected" which is incorrectly thought of to be an error. This is documented in PHP bug #49948.



Extension methods implementation revamped

at 2010-08-18 in RFCs5.8-SERIES by friebe

Just shortly after announcing the removal of the original extension methods implementation we have now come up with a faster, less-clumsy and well-behaving extension method implementation - and have reactivated the corresponding RFC, scheduled for implementation in SVN next week.


(more)

PHP 5.3.3 support

at 2010-08-10 in Announcements by friebe

Following the release of PHP 5.3.3, the XP Framework now supports this PHP version in both 5.7.11-dev and 5.8.0-dev release branches.



5.8.0RC1: The first pre-release of the upcoming 5.8-SERIES

at 2010-08-10 in ReleasesAnnouncements5.8-SERIES by friebe

Branch The 5.8-branch has now been maintained since almost a year, gathering features and maturity and is now basically a 5.7.11-dev with the most of the items planned for the 5.8.0 release:

  • Revamped generics implementation - will now also work for primitives
  • Private / protected member access via reflection even without PHP 5.3's setAccessible()
  • A new ArrayType class and the typeof(var) core functionality to complete the XP framework's type system
  • The array and map indexer this() to reduce temporary variables with missing array dereferencing
  • ...and many more

You can grab a release as always by using our setup routine:
  $ cd ~/xp
$ wget http://releases.xp-framework.net/setup/5.8.0RC1 -O - | php -- -d ~/bin/
...to give it a test run. Enjoy:-)



Generics of primitives

at 2010-08-10 in Examples5.8-SERIES by friebe

Like in C# (and unlike Java), primitives can be used as components of generics in the 5.8-SERIES. Given a vector util.collections.Vector<string>, the following applies:

<?php 
// OK
$v[]= "Hello";

// Throws a lang.IllegalArgumentException
$v[]= 1;
?>

Primitives can also be used in other generic collections types, e.g. Set and Map implementations as well as Stack and Queue.



RFC #0093: xml.meta

at 2010-08-09 in RFCs by friebe

Scope of Change
The xml.meta API will be extended to include a way to marshal objects to trees instead of only to strings, and unmarshal XML from streams.

Rationale

  • Performance improvement over Tree::fromString(Marshaller::marshal())
  • Use the tree / node objects for further modification
  • Performance improvement over Unmarshaller::unmarshal(Streams::readAll())

Read the full RFC here



Extension methods removed

at 2010-07-31 in 5.8-SERIES by friebe

The extension method implementation has been removed from the 5.8 branch again, its quality and performance was way below expectation:

  1. Clumsy declaration syntax
    The xp::extensions('lang.types.ArrayList', __CLASS__); in the static initializer block looks weird, it should be replaced by a more syntax-like feature, e.g. a base class (like enums), annotations (like the new generics implementations) or a construct like export().
  2. Full import
    As of point where a class gets used, its extension methods were globally available, not only for the scope they were used in. This may lead to confusion about methods "appearing" on objects all of a sudden.
  3. Slow implementation
    The first shot came with a serious performance impact, more needed to work around #2
That said, RFC #0189 has been reset to draft status.

It's not dead though, if the issues can be resolved, it will be re-added again.



Subscribe

You can subscribe to the XP framework's news by using RSS syndication.


Categories

News
General
PHP5
Announcements
RFCs
Further reading
Examples
Editorial
EASC
Experiments
Unittests
Databases
5.8-SERIES