Re: [SMARTY-DEV] Re: object support (more thoughts)

From: Date: Mon, 13 Jan 2003 23:14:21 +0000
Subject: Re: [SMARTY-DEV] Re: object support (more thoughts)
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-531@lists.php.net to get a copy of this message
If we force registration of objects, then you have to access an object like this: {$foo->bar} {foo->bar} This means you cannot have an array of objects to access in a section loop, such as: {section name=bar loop=$foo} {$foo[bar]->blah} {/section} If we need to support that, then it would mean objects must be assigned instead of registered. If they are assigned, then individual control over method access isn't really feasible, we would have to allow access to all methods exluding private ones. All or none. This also complicates the syntax, we are almost back to square one {$foo->bar()} So decisions: 1) register all objects, and can only access directly: {$foo->bar} <-- property {foo->bar p1="foo"} <-- method PROS: * syntax kept to a bare minimum CONS: * not as flexible can't assign arrays of objects 2) assign all objects, and allow access to all methods excluding private ones: {$foo->bar} {$foo.bar->blah} {$foo[bar].foo->blah} {foo.bar[foo]->foo p1="foo" p2="bar"} PROS: * can assign objects or arrays of objects, more flexible CONS: * syntax is more complex * can't control individual method access I'm really leaning toward option #1. Is there a practical use for assigning arrays of objects? Monte

« previous php.smarty.dev (#531) next »