Re: [SMARTY-DEV] Re: object support

From: Date: Mon, 13 Jan 2003 19:29:58 +0000
Subject: Re: [SMARTY-DEV] Re: object support
References: 1 2 3 4 5 6 7 8  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-527@lists.php.net to get a copy of this message
On Mon, 2003-01-13 at 12:45, Bharat Mediratta wrote: > Thanks for considering this. > > From: "Monte Ohrt" <monte@ispi.net> > ... > > This sounds like a sound solution, I like the registering idea. I think > > there still needs to be a distinction between function calls and object > > calls: > > I respectfully disagree. A template designer does not need to know > the underlying technology behind a template call. As far as a template > designer is concerned, he/she is given a very simple API with functions > and parameters and shouldn't have to know *anything* about how that > API is implemented. A template designer cannot be expected to know > anything about OOP and so these differences in syntax are going to > be confusing. I don't want to have to explain anything about OO in > my "how to write a template" docs! I agree that a template designer does not need to know the underlying technology, but that is not the reason for doing this. There needs to be a distinction, something the template engine can syntactically distinguish between functions and objects, which basically means a new syntax if not done by a template function. Something more subtle would be nicer than the "object" function call, I was just trying to think of something that worked in the current engine framework. The idea of {foo.bar p1="foo"} is a step in the right direction since functions cannot have periods in the name. It's still a distinction, and foo.bar is an already familiar syntax. Here's a concern: {$foo.bar} <-- access to array key {foo.bar} <-- access to object method Is it OK to have such similar syntax? Future flexibility problems? What if you wanted to access an object property, how do you distinguish between a property and a method? Remember, an object can have a method and property of the same name. We already support property access for _assigned_ objects like this: {$foo->bar} Monte

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