[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl5-porters
Subject:    Re: Variable naming (was: Re: Maybe it's time to disallow two variables with the same name and diffe
From:       Branislav_ZahradnĂ­k <happy.barney () gmail ! com>
Date:       2024-01-03 11:25:16
Message-ID: CAB=rbOng7E6qhzA5mHDQY_EuemKuSEK-xqu3+9p=cu=sncKVjQ () mail ! gmail ! com
[Download RAW message or body]

>
> Saying "foreach person in people" reads better than "foreach person in
> person",
> doesn't it?  The latter seems rather confusing or nonsensical.
>
>
.. and here I'm where I don't know how to express myself :-) Let's try:

you should not specify "in person" or "in people" at all. You should be
describing quality of persons
you want to iterate over.

Going back to cities (pseudocode):

foreach city { }
foreach regional_capital (country == France)

Regarding plural:
Iterators, generators, lookups - all of them may be plural.


>
> For these hashes it is NEITHER plural nor singular, rather the name should
> reflect the relationship.
>

With small modification this is probably best description: "For collections
..."

[Attachment #3 (text/html)]

<div dir="ltr"><br><div class="gmail_quote"><blockquote class="gmail_quote" \
style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"> <br>
Saying &quot;foreach person in people&quot; reads better than &quot;foreach person in \
person&quot;, <br> doesn&#39;t it?   The latter seems rather confusing or \
nonsensical.<br> <br></blockquote><div><br></div><div>.. and here I&#39;m where I \
don&#39;t know how to express myself :-) Let&#39;s try:</div><div><br></div><div>you \
should not specify &quot;in person&quot; or &quot;in people&quot; at all. You should \
be describing quality of persons</div><div>you want to iterate \
over.<br></div><div><br></div><div>Going back to cities \
(pseudocode):</div><div></div><div><br></div><div>foreach city { }</div><div>foreach \
regional_capital (country == France)<br></div><div><br></div><div>Regarding \
plural:<br></div><div><div>Iterators, generators, lookups - all of them may be \
plural.<br></div><div></div>  <br></div><blockquote class="gmail_quote" \
style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"> <br>
For these hashes it is NEITHER plural nor singular, rather the name should <br>
reflect the relationship.<br></blockquote><div><br></div><div>With small modification \
this is probably best description: &quot;For collections \
...&quot;</div><div><br></div><br></div></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic