Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:15989 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87730 invoked by uid 1010); 18 Apr 2005 12:10:57 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 87672 invoked from network); 18 Apr 2005 12:10:57 -0000 Received: from unknown (HELO calligram.co.uk) (127.0.0.1) by localhost with SMTP; 18 Apr 2005 12:10:57 -0000 X-Host-Fingerprint: 212.69.217.33 smtp-relay04.x-mailer.co.uk Linux 2.4/2.6 Received: from ([212.69.217.33:47909] helo=smtp-relay04.x-mailer.co.uk) by pb1.pair.com (ecelerity 1.2.12rc1 r(5476:5477)) with SMTP id 1F/C3-18700-0D3A3624 for ; Mon, 18 Apr 2005 08:10:56 -0400 Received: from [212.69.210.169] (helo=emarket.dsvr.co.uk) by smtp-relay04.x-mailer.co.uk with esmtp (Exim 4.30) id 1DNV5Y-0003kq-Uu for internals@lists.php.net; Mon, 18 Apr 2005 13:10:52 +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 j3ICAqs15127 for ; Mon, 18 Apr 2005 13:10:52 +0100 Organization: Calligram Ltd To: internals@lists.php.net Date: Mon, 18 Apr 2005 13:19:55 +0100 User-Agent: KMail/1.7.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <200504181319.56004.duncan@calligram.co.uk> Subject: Attributes support proposal From: duncan@calligram.co.uk (Duncan McIntyre) Hello, I am playing around with an extension to the Zend Engine 2 to allow class properties and methods to be tagged with attributes. These attributes would then be accessible through the Reflection classes: !---------- example -------------! class Storable { [serializer:toString; persistent:true; ] public $date; function __construct() { $this->date = new CDate(); } ... ... } $store = new Storable(); $rf = new ReflectionProperty("Storable","date"); $s = $rf->getAttributeValue("serializer"); if(!is_null($s) && method_exists($store, $s)) { $v = $store->date->$s(); } else { $v = $store->date; } echo "the value of the date property is $v"; !------------- /example -------------! I would find the ability to set attributes extremely useful in building frameworks a la Ruby On Rails. Anyone think this is a good idea? Duncan