Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:16001 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37028 invoked by uid 1010); 18 Apr 2005 15:31:54 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 37002 invoked from network); 18 Apr 2005 15:31:54 -0000 Received: from unknown (HELO pb1.pair.com) (127.0.0.1) by localhost with SMTP; 18 Apr 2005 15:31:54 -0000 X-Host-Fingerprint: 212.69.217.34 smtp-relay05.x-mailer.co.uk Linux 2.4/2.6 Received: from ([212.69.217.34:57240] helo=smtp-relay05.x-mailer.co.uk) by pb1.pair.com (ecelerity 1.2.12rc1 r(5476:5477)) with SMTP id 78/45-18700-9E2D3624 for ; Mon, 18 Apr 2005 11:31:53 -0400 Received: from [212.69.210.169] (helo=emarket.dsvr.co.uk) by smtp-relay05.x-mailer.co.uk with esmtp (Exim 4.30) id 1DNYE1-0003ji-EA; Mon, 18 Apr 2005 16:31:49 +0100 Received: from variable (host81-137-241-101.in-addr.btopenworld.com [81.137.241.101]) (authenticated (0 bits)) by emarket.dsvr.co.uk (8.11.7/8.11.7) with ESMTP id j3IFVmA00688; Mon, 18 Apr 2005 16:31:48 +0100 Organization: Calligram Ltd To: Wez Furlong Date: Mon, 18 Apr 2005 16:40:47 +0100 User-Agent: KMail/1.7.1 Cc: internals@lists.php.net MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <200504181640.47897.duncan@calligram.co.uk> Subject: Re: [PHP-DEV] Attributes support proposal From: duncan@calligram.co.uk (Duncan McIntyre) 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