On 4/18/05, Wez Furlong <[EMAIL PROTECTED]> wrote:

> Can you demonstrate some other practical use for attributes in PHP?
> (please post an example to the list, even if it's psuedo-code--we're
> mostly too busy to go off and read about something new until we've
> been persuaded it's worth doing ;-)

I hope I'm not disturbing anyone, just to add one more use for
attributes other than I've mentioned before:

Rails (ActiveRecord) [I guess] uses attributes to do pseudo-ORM of
classes to database records. This way you don't even need to
"generate" classes, the classes already know how to "behave" in the
database because the metadata is already built-in. Just a rough
sketch:

[columnType: "VARCHAR", size: 20] public $name;
[columnType: "DATE"] public $birthDate;

It's very true that most things you can do using attributes you can do
using other techniques (especially in dynamic languages like PHP,
Ruby, Perl, ...) much the same way as most things you can do using OOP
is doable using pure procedural.

-- 
Hendy Irawan
http://www.gauldong.net
http://dev.gauldong.net

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to