I realize there are a couple terms you're using that I think I understand generally but not exactly as technical terms as you're applying them here-- mostly "prototypical inheritance". Any quick links to point me in the right direction on that?
By the way, the more I think about it, the full approach will be a combination of everything discussed above. A sentence like "John saw Bill" will end up working out something like this:
PHP Code:
$x = new Entity;
$x->John();
$y = new Entity;
$y->Bill();
$z = new Entity;
$z->See($x,$y);
$z->tense('Present');
//...
There's obviously something a little weird about the functions "John()" and so forth that might not be defined. But that could be worked out technically in a few ways. One option would be to simply have a default ->set('property') method.
Part of the complication also comes from trying to actually represent this in PHP, which isn't really my goal. (It could be represented in PHP, but might require slightly different notations. Instead, it would be simpler as this pseudo-code:
Code:
x->John;
y->Bill;
z->See(x,y);
z->Tense('Present');
...
It's also compatible with the old format but simply keeping the variables/objects for reference:
Code:
John(x); //or set(x,'John');
Bill(y);
See(z,x,y);
Tense(z,'Present');
...very rough, but good enough. I'd still prefer the conceptual perspective of OOP, but the effects would be roughly equivalent I think.
Bookmarks