incubator-zeta-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maxime Thomas <maxime.t...@gmail.com>
Subject Re: [zeta-dev] Naming convention : *List variables
Date Tue, 08 Mar 2011 10:32:00 GMT
2011/3/7 Jerome Renard <jerome.renard@gmail.com>

> Derick, Patrick,
>
> On Mon, Mar 7, 2011 at 7:09 PM, Patrick ALLAERT
> <patrick.allaert@gmail.com> wrote:
> > 2011/3/7 Jerome Renard <jerome.renard@gmail.com>:
> [...]
> >
> > There is nothing wrong being explicit about the content of the
> > variable, but I would refrain from using types like "Array", "List",
> > "Integer",...
>
> Maybe I have not been clear enough.
>
> The point is not to name a variable acording to its type for ints,
> floats etc, etc.
>
> The point is to provide a visual/semantic help for arrays (or
> hastables) *only* by suffixing them.
> Using a variable in its plural form might not be ideal for some
> people, this is what I am
> trying to adress with this idea, which maybe is a stupid one.
>
> The rest (int and others) remains unchanged.
>
> :)
>
> --
> Jérôme Renard
> http://39web.fr | http://jrenard.info | http://twitter.com/jeromerenard
>


Ok, so if I understand it well : you put List after variables that you will
use in foreach.
Do we put other variables types in foreach than arrays ?

For the name rules for variables, I personnaly used the "_id" suffix
to semantically design a integer variable, the "s" suffix for lists (it
could be also more gramatically based rules : child / children) and by
default vars are strings.
For small treatments, not meaningful, I prefer to use "anonymous" variable
names like $i, $j, $k, $v... It could be for example, a generic function
that processes an array.

-- 
Maxime
maxime.thomas@wascou.org | www.wascou.org | http://twitter.com/wascou

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message