Re: [SMARTY-DEV] object registration committed
| From: | Jan Rosier | Date: | Fri, 24 Jan 2003 13:09:00 +0000 |
| Subject: | Re: [SMARTY-DEV] object registration committed | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-614@lists.php.net to get a copy of this message | ||
> >> The first is shorter and an existing syntax, the second is more
> >> consistant with the longer object syntax and is distinct, possibly
> >> avoiding future syntax collisions. So which is better, existing syntax
> >> or distinct, more consistant syntax?
> >
> > Since a template consumer already needs to know which variables
> > "have" methods and which don't, I think the explicitness of
> > "->"
> > will work better in the long run for method calls. How about
> > allowing "." or "->" for property access, but requiring
> > "->"
> > for methods?
>
> I'd certainly vote for explicitness. Objects are and should be treated
> differently. That will make it easier to spot and avoid errors because
> you thought or forgot that one was the other. It also makes Smarty more
> approachable for existing PHP programmers that'll get a template
> language which behaves more like they would expect.
> --
I agree with this. Using '->' for objects makes it easier to see which is
which and might even make things easier to explain to the template designer.
For instance an methode of an object can take params and an array can't. The
difference might be hard to explain
Example:
{$object.Methode p1=2 p2=23} works
{$array.Element p1=1 p2=23} doesn't work (or not as expected ;-) )
Greetings,
Jan Rosier
The best way to predict your future is to create it.