Further readingShow me the codeat 2010-09-27 in Editorial, Further reading by friebeAfter reading and agreeing with Show me the code some time ago, I thought about how to integrate source code examples on the XP Framework website. While lots of blog postings here contain sourcecode, this is not prominent enough - so I set up a new site dedicated to this purpose: The XP Code galleries. Enjoy Array dereferencingat 2010-09-22 in Further reading by friebeWhile array dereferencing was added to the PHP runtime's so-far unreleased SVN trunk a while ago, this feature isn't going to be backported to older PHP versions, which the XP-Framework will continue to support for quite a while. We've thus added a core functionality, this(), to make indexer access possible: $a= $class->getMethods()[0]; // Supported in PHP as of 2011* * Educated guess, there is no communicated release date for PHP "next" Y2K38at 2010-08-25 in Further reading by friebeIn 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")));'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. $d= new Date('2040-02-01');See also http://en.wikipedia.org/wiki/Year_2038_problem and - with a humouristic take: http://xkcd.com/607/ Generics in C#, Java, and C++at 2009-11-14 in Further reading, RFCs by friebeIn this interview from quite a while ago Bruce Eckel and Bill Venners talk with Anders Hejlsberg about generics implementations in C# and Java - the differences in their implementations, type erasure vs. runtime instantiation, reflection and how they compare to C++'s template mechanism. This has inspired us to come up with RFC #0193 - and moving our generics implementation closer to the one in the CLR. Type hinting discussion and contractsat 2009-07-12 in Further reading by friebeIn the recently ongoing type-hints discussion on the PHP internals mailinglist (see also the PHP Wiki), an interesting proposal was made. It suggests using functions to verify argument types instead of introducing a type checking mechanism which is not strict enough for some, not flexible enough for others and too magic for yet another group. function array_of_numeric($x) {See also here, here and here. PHP-Arrays: Maps and listsat 2009-04-05 in Editorial, Further reading, RFCs by friebeIn the PHP world, arrays are maps are lists: $a= array(1, 2, 3); // #1: A list Now this is (almost) perfect as long as you stay inside the PHP world; the only thing you have to know is when to be able to use array functions operating on "associative arrays" (like asort) instead of "numeric arrays" (sort), which is usually achieved by a bit of discipline. This is where a slight problem even inside the PHP world (and that's why it's only almost perfect) starts showing: There is no easy way to keep the both apart. (more) Casting an object array to a string arrayat 2008-07-19 in Further reading by friebeWhile testing the new EASC server and client implementations we're currently working on, we asked ourselves how to cast an object array to, for example, a string array. The following is an array of objects consisting solely of strings: Object[] strings= new Object[] { "Hello", "World" };The first thing we tried was to cast it via (String[])strings. This is legal sourcecode but will raise a java.lang.ClassCastException in Java, and a System.InvalidCastException in C#, both at runtime. (more) Exceptions in Javaat 2008-06-25 in Further reading by friebeFound this nice article on exceptions in Java - from a historic overview of Oak, on checked and unchecked exceptions, and asynchronous exceptions it explains nicely (and with code examples) what the Java exception mechanism is about. What I like most are the best practices section, which applies not only to Java:
http://www.javaspecialists.eu/archive/Issue162.html Frank Kleine on Namespacesat 2007-11-11 in Further reading by friebeOn a short note: In Gathering practical experience with namespaces, Frank describes his first impressions of PHP 5.3 with namespaces:
Reminds me of the rule of thumb that one never has enough unittests PHP6 Namespaces patch backportedat 2007-07-21 in Further reading by friebeBeginning of this month, Dmitry Stogov from Zend published a patch implementing namespaces in PHP6. To be able to begin playing around with it without adding further points of possible failures for our XP unittests with new PHP6 (e.g., unicode-related breakage), I started and after a day's work succeeded in backporting the patch to current CVS HEAD, that is, PHP 5.2.4-dev. (more) |
|