[Koha-devel] tt style point

Ian Walls ian.walls at bywatersolutions.com
Fri Sep 16 14:33:59 CEST 2011


Colin,


I made the decision to require parentheses around the variables for the sake
of consistency.  All the other template in Koha do it that way, right or
not.  I'm certainly open to it dropping the parentheses; they don't seem to
follow standard practice, and while I'm sure no complications are introduced
by them, it does add extra keystrokes and one more "little Koha nuance" to
any patch submitted.

We have not revisited the Coding Style Guidelines for Koha since switching
to Template Toolkit, and I think this should certainly be one of the issues
we address when we do.  Until then, I recommend we maintain a consistent
style in this, even if we're eventually going to drop it.

What does the rest of the community think?  Is it worth being picky about
such a thing until we can decide for sure one way or the other?  Or, more
pragmatically, should such a thing impede QA?

Cheers,


-Ian

On Fri, Sep 16, 2011 at 8:13 AM, Colin Campbell <
colin.campbell at ptfs-europe.com> wrote:

> Hi
>  I noticed that in QA someone is changing tt constructs from
> [% IF variable %]
> to
> [% IF (variable) %]
> as style issues
>
> I think this is very bad style for the following reasons:
> You'll not see it in any of the documentation for tt either the perldoc,
> on the tt site or in the badger book. (and I've never seen it on any tt
> using project).
> It adds nothing (we hope) syntactically.
> My initial response is that as we are not using normal tt syntax,
> something "clever" or magic is going on here rather than a usual [% IF %]
> It detracts from readability. (ok slightly subjective but the
> environment already makes full use of the top row of the keyboard.)
> Whats its relation with the legitimate use of brackets e.g. to call
> vmethods in regexps [% IF variable1( variable2 ) %]
> The authors didn't require brackets around more complex boolean
> expressions [% IF variable == 0 %] why bring em back in for simple
> variables.
> Could it have unforeseen side effects (don't know but I don't want to
> spend time researching it)
> It confuses the reader of the code and the writer of subsequent code -
> 'should I use () no? when? why?
> It strikes me as weird (!!)
>
> In short I'm arguing for clarity...
>
> I realise that Chris bracketed things in the great template conversion
> but I think that was defensive programming when he couldn't rely on
> variable always being one. And we shouldn't be encouraging or enforcing
> others to use a peculiar idiolect rather than standard practice.
>
> Colin
>
>
> --
> Colin Campbell
> Chief Software Engineer,
> PTFS Europe Limited
> Content Management and Library Solutions
> +44 (0) 845 557 5634 (phone)
> +44 (0) 7759 633626  (mobile)
> colin.campbell at ptfs-europe.com
> skype: colin_campbell2
>
> http://www.ptfs-europe.com
> _______________________________________________
> Koha-devel mailing list
> Koha-devel at lists.koha-community.org
> http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
> website : http://www.koha-community.org/
> git : http://git.koha-community.org/
> bugs : http://bugs.koha-community.org/
>



-- 
Ian Walls
Lead Development Specialist
ByWater Solutions
Phone # (888) 900-8944
http://bywatersolutions.com
ian.walls at bywatersolutions.com
Twitter: @sekjal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/koha-devel/attachments/20110916/1b6980d7/attachment.htm>


More information about the Koha-devel mailing list