[Petal] attributes question

Jean-Michel Hiver jhiver at mkdoc.com
Sat Jul 26 10:08:59 BST 2003


> Jean-Michel Hiver wrote:
> > As a side effect, it is true that Petal will consider anything that is
> > not defined or an empty string to be 'nothing'. I think this is purely
> > an implementation issue and not a fundamental violation of TAL.
> 
> Hrm.  Does this mean that '<span petal:replace="myvarable">Misspelled 
> variable!</span>' will silently disappear?  This would be bad!

It does :) I'm just quite happy to keep things simple: if it evaluates
to nothing, then it's nothing. I find it really awkward to invent a new
kind of nothing.

That being said, I wouldn't mind introducing a warning if you're trying
to access a variable that doesn't even exist, as opposed to be just
undefined.

How about methods which return an undefined value? I don't want them to
return a 'nothing' object because:

1/ The method would then return a object, which as far as Perl is
concerned is a TRUE value.

2/ Nearly every method which is used in templates would have to know
about TAL stuff. In the same way I don't want Perl stuff all around in
my templates, I also don't want TALisms all over the place in my code.

Any suggestions?

Cheers,
Jean-Michel.


More information about the Petal mailing list