[Petal] New syntaxes
William McKee
william at knowmad.com
Wed Jul 9 11:43:24 BST 2003
On Wed, Jul 09, 2003 at 12:08:56PM +0100, Fergal Daly wrote:
> There are 4 changes I've made or want to make and I want to see what people
> think
These all look interesting Fergal but are beyond my basic use of Petal
templates at the moment. I like to keep things really simple and don't
mind sacrificing speed for simplicity when it comes to templates that
will be edited by designers.
As for performance, you mentioned that the hints with explicit accessors
can change the code generated from
> do{
> ref(my $ref = (($hash)->{"thing"})) || die "Not a ref";
> Scalar::Util::blessed($ref) &&
> (
> UNIVERSAL::can($ref, "key") or UNIVERSAL::can($ref, "AUTOLOAD")
> ) ? $ref->key() : $ref->{"key"}
> }
to
> $hash->{"thing"}->{"key"}
This obviously looks like a great improvement. Would it be possible to
change the code generator to produce the faster output after determing
the nature of thing/key? Since the templates are cached in memory or
onto disk, it seems like it'd be ok to run some less efficient processes
initially while building the compiled template. I guess this may prove
problematic if programmers are relying on Petal to be flexible when
parsing the templates though. If that's the case, maybe we could add
another parameter to indicate whether to fixate references in the
template when the code generator produces the compiled template.
Thanks,
William
--
Knowmad Services Inc.
http://www.knowmad.com
More information about the Petal
mailing list