You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@beehive.apache.org by Chad Schoettger <ch...@gmail.com> on 2006/02/13 21:02:54 UTC

Proposed fix for BEEHIVE-1066...

To resolve the bug BEEHIVE-1066 I was thinking of prefixing the offending
local variables in the ControlBean.vm  velocity template as follows:

__bc_<var_name>

Does anyone on the list have any thoughts about making this the standard
naming pattern for local variables in the control's velocity templates?  It
would make the generated code more difficult to read but should eliminate
the possibility of some variant of this bug occurring in the future.

- Chad

Re: Proposed fix for BEEHIVE-1066...

Posted by Kyle Marvin <ky...@gmail.com>.
Even a single underscore or double underscore prefix seems
reasonable... I've never seen anyone use an underscore prefix for
method args, the convention (when used) seems to be mostly for local
args.

If you want to be extra careful, you could always add APT warnings if
someone uses a pattern that potentially conflicts (like a method arg
named '__bc_foo" in your original proposal).    This seems like
reasonable protection for the edge cases.

The other option would be to leave the local variables as is, and
prefix their usage with "this.", which will prevent accidental
override by a (same-named) method arg.  This is only one character
more than '__bc_"   ;)

Cheers!

-- Kyle

On 2/15/06, Eddie O'Neil <ek...@gmail.com> wrote:
> Chad--
>
>   Seems like the right change to make.  If we're going to do it for
> one file, it should probably be done for all of the generated sources
> to make it clear what was code gen'ed (and what the framework
> implicitly owns).
>
>   So, I'd say add "__bc_" as a prefix to all of the local variables
> declared in generated Controls files.
>
>   My $0.02...
>
> Eddie
>
>
> On 2/13/06, Chad Schoettger <ch...@gmail.com> wrote:
> > To resolve the bug BEEHIVE-1066 I was thinking of prefixing the offending
> > local variables in the ControlBean.vm  velocity template as follows:
> >
> > __bc_<var_name>
> >
> > Does anyone on the list have any thoughts about making this the standard
> > naming pattern for local variables in the control's velocity templates?  It
> > would make the generated code more difficult to read but should eliminate
> > the possibility of some variant of this bug occurring in the future.
> >
> > - Chad
> >
> >
>

Re: Proposed fix for BEEHIVE-1066...

Posted by Eddie O'Neil <ek...@gmail.com>.
Chad--

  Seems like the right change to make.  If we're going to do it for
one file, it should probably be done for all of the generated sources
to make it clear what was code gen'ed (and what the framework
implicitly owns).

  So, I'd say add "__bc_" as a prefix to all of the local variables
declared in generated Controls files.

  My $0.02...

Eddie


On 2/13/06, Chad Schoettger <ch...@gmail.com> wrote:
> To resolve the bug BEEHIVE-1066 I was thinking of prefixing the offending
> local variables in the ControlBean.vm  velocity template as follows:
>
> __bc_<var_name>
>
> Does anyone on the list have any thoughts about making this the standard
> naming pattern for local variables in the control's velocity templates?  It
> would make the generated code more difficult to read but should eliminate
> the possibility of some variant of this bug occurring in the future.
>
> - Chad
>
>