This comes out of an idea to use the overload capability in PHP5 for writing terser, declarative statements. In particular I have been rethinking the mock objects interface to Simpletest. For quite a while I have wanted to define a mock like so...
PHP Code:
interface Doubler {

TestOfStuff extends UnitTestCase {
testStuffUsingDoubler() {

$stuff_with_doubler = new Stuff(new MockDoubler());

This should be possible in PHP4, but as soon as I use the overload() within SimpleTest everything breaks. Thus it would have to be introduced in a PHP5 only version .

The main point is that a lot of magic can happen in that mock declaration. This really will be all of the syntax. Compare with the situation now where a generate call has to be made, then the mock created and then an expectation set on it and finally thereturn value is set. I've gone from five lines to two. This way works with dependency injection too.

It can be extended to multiple instances and multiple method calls like so...
PHP Code:
Basically it has become a declarative language. Within the __get() method there will likely be a bunch of context objects flying around, but that's just implementation. Probably a not too difficult one at that. I've done some experiments and all seems to be well. So much so I'd liketo explore it further.

How about an ActiveRecord subclass like this...
PHP Code:
class Person extends ActiveRecord {
__construct($transfer false) {

ContactEmail extends ActiveRecord { ... } 
Now I'm using the domain language to specify types in a database. The $transfer object is the incoming data when the object is instantiated from a finder. The values in brackets are the defaults, the "uk" here. If a class type is given, then it will be a collection of other records.

To set up a new one...
PHP Code:
$transaction = new MysqlTransaction();

$marcus = new Person();
$marcus->first_name 'Marcus';
$marcus->family_name 'Baker';
$marcus->emails->add->address 'marcus@lastcraft.com';

The actual data types are negotiated on the save() call. The MysqlTransaction can be an abstract factory of type mappers as well as holding the connection information.

Implementation aside, I think it has a lot in common with the ruby style small domain languages.

I bet there are other uses too.

yours, Marcus