Wez,
(I added internals back in to the Cc:; presumably you missed that out
by accident in your reply)
Thanks. Can you delete my email address from list as well please? :-) Grr.
stupid me. Hello spam bots.
I noticed I'd missed the list off cc, so I posted an edited version, which I
guess you've seen.
It's just a different way of expressing your code; a pro-attributes
programmer is obviously not going to like coding with interfaces, and
perhaps vice-versa.
I don't see them as en either/or. They can work together. My edited example
showed (a little) better how attributes can be used. The "persist" attribute
tells the system that this property needs to be saved to the database. The
"serialize" attribute tells it to call the property's "toString()" method
(which I hope answers your point about my nasty serialization code).
Don't let my use of serialization as an example get you down!
Anyway, you're right: my examples so far suck. I'll come back with some
better ones when I've got more time. Maybe something about how attributes can
provide hints to a rendering engine on how to choose the correct widget to
control a property's value in a form.
Also, Hendy's example of using attributes to describe how you want a database
to represent a property is a good one. That's just the problem I've got at
the moment, and I solve it with a properties() method. But it's ugly and
unwieldy.
I take your point about namespaces, but that's an issue for any language which
uses attributes.
Duncan