[Petal] New syntaxes

Jean-Michel Hiver jhiver at mkdoc.com
Wed Jul 9 16:43:09 BST 2003


> The thing I like about thing{key}[0] is that it's basically Perl which should 
> be natural for anyone using Petal.

But I don't think it should be looking like Perl. In fact, it should be
looking like anything but Perl. I don't want template designers to have
to think about Perl. Well, that's what I think anyways, as long as it's
backwards compatible I'm not too bothered :)


> Is there a need for the current Petal to understand these extension? As long 
> as Petal::CodePerl (PCP) remains backwards compatible and passes Petal's test 
> suite then we can play with ideas there, rather than fiddling with Petal.

I guess...


> I think PCP implements this except I'm not sure about that last one, should 
> you have written $hash->{foo}->bar ($hash->{baz}) ? That's what PCP gives at 
> the moment.

Ooops, yes, that's what I meant.


> I'd like there to be a way to signal the end of the argument list, so that you 
> can call methods on the return value of a method. Wrapping the args in () 
> seems to be a nice and familiar way of doing that.
> 
> Or do you mean that ${} would work outisde strings? So I could do
> 
> ${foo/bar baz}/frob

Hey, that's a neat idea :)

Outside strings you could use either foo or $foo or ${foo}, but inside
strings you would have to use $foo or ${foo}.

+1 on that.



> This reminds me of something else I meant to mention - modifiers. They are 
> <snip />

> sub perl
> {
> 	my $self = shift;
> 	my $expr = shift;
> 
> 	return "uc($expr)";
> }

Surely this method should be called 'inline' shouldn't it?


> Without making this change it will be impossible to compile modifiers without 
> modifiying the grammar every time you add a modifier,

This sounds like an excellent plan. I'm looking forward to it.

It would be good to see how those coolie changes work. I'm looking
forward to the next release of CodePerl... It'll be interesting to see
if it works with all my existing Petal templates :) 


Cheers,
-- 
Building a better web - http://www.mkdoc.com/
---------------------------------------------
Jean-Michel Hiver
jhiver at mkdoc.com  - +44 (0)114 255 8097
Homepage: http://www.webmatrix.net/


More information about the Petal mailing list