Hi

For what my vote is worth:

+1 on including #macros ( disabled by default )
Although #macros can prove to be a powerful feature it should be used with care
and therefore I think we should disable them by default to prevent rookies of
shooting themselves in the foot.  Kinda like stricter gun laws :-)

-1 on allowing #macros or #directives inside #macros ( althought I don't believe I
have a -1 voice )
As soon as you make calls to other #macros from inside a #macro you create nested
structures that does not conform to the original idea for macros.

The original idea (as far as I can see) is to provide template writers with a
mechanism to ease template writing and avoid unnecessary copy/paste.  With calls
to #macros within #macros you can create sufficiently complex (and ugly) code that
will come back to haunt you.

For example:

#macro (print1 $param1)
    $param1.someStuff
#end

#marco (print2 $param2)
    #foreach $x in $param2
        #print1 ($x.aList)
    #end
#end

#macro (print3 $param3)
    #foreach $y in $param3
        #print2 ($y.aList)
    #end
#end

Code like this can become difficult to maintain.  Let's say that the type of
objects in $x.aList changes.  You don't have any warning that #print3 will fail
because of #print2's call to #print1.  You won't be able to see a stack-dump and
you won't know where to start your search for the bug, when #print3 suddenly stops
working.

Another potential problem.  Say you call #print3 with two different objects, but
both has an aList property.  Unfortunately one of them fails in #print2.  You fix
#print2 and in the process unknowingly break a lot of code written by other people
who can't understand why #print3 (seemingly unchanged) does not work anymore.

This problem worsens when project groups grows larger.  Image the headaches when
multiple #macro authors start to call each other's #macros that uses multiple java
objects stuffed into the context by multiple programmers.

~ Leon


----- Original Message -----
From: Jason van Zyl <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, October 09, 2000 3:40 PM
Subject: Vote For Macros


> Hello,
>
> Can we please vote on the #macro directive today. If
> we want it in the core, and if so how it will
> behave by default.
>
> I think they are a powerful mechanism, but agree that
> they might possibly be the source of potential
> problems. This remains to be seen, and we probably
> won't be able to tell until some people try it.
>
> I'm am all for setting up default behaviour that
> is safe: that could range from turning off
> macros by default, to not allowing #macros inside
> #macros, to not allowing #direcitves inside macros.
>
> Insofar as the implementation, Geir has this
> worked out and he's ready to integrate his
> code. I will also help him if we agree that #macros
> are a good thing.
>
> So could everyone throw in their 2c today please.
>
> jvz.
>
> ---
>
> Jason van Zyl
> [EMAIL PROTECTED]
>

Reply via email to