[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [SCM] Debian package checker branch, master, updated. 2.5.2-11-g39af0d7



On 2011-08-14 00:11, Jeremiah C. Foster wrote:
> 
> [...]
>> On the other issue, I thought the "$C, @C"-thing was covered by the
>> "re-use" of same variable in lexical scope, but it turns out it isn't
>> (probably due to the "types" being different).
>>  I can see the idea behind it now, sort of like a C-string where you
>> can process the string as a whole (strcmp(s, "text")) or individual
>> characters (s[0]).  I guess the perl way of doing that is to declare two
>> variables with same name and different type.
> 
> Yeah, this is exactly what perl does. The sigil is meant to be the mnemonic,
> so you know that "$" is scalar and "@" is array. 
> 

So I knew the sigil meant declared its type, but from there to giving
them a separate namespace... I missed that.

>>  In the given case I can see the use of this.  That being said, I have
>> my concerns blessing wide-spread use of this.  You may remember I got a
>> bit confused with:
>>
>> """
>> $checks or ($checks = join(',',keys %check_info));
>> [...]
>> $checks{$c} = 1;
>> """
>> from frontend/lintian in 2.4.3: $checks was a comma-separated list and
>> %checks was a hash where the keys were elements from said list.
> 
> It looks like in this case the second $checks is actually a reference to a hash.
> More: http://oreilly.com/catalog/advperl/excerpt/ch01.html
> 

It wasn't... It was an actual hash (and a scalar).  There is a longer
version in my reply to Russ's email (or you can checkout 2.4.3 and have
a look at frontend/lintian).

>> Can you point me to the section on "my ($v, @v, %v);" in the perl
>> documentation (not really sure what to look/google for here).  I would
>> like to get a second look on this. :)
> 
> Perl has a rich set of datatypes, that URL above describes most of those that
> you'll run into, i.e. scalars, arrays, hashes and references to all three.
> 

Right, I know.  :) I was looking for the documentation that mentioned
that "my $a;" can co-exists" with "my @a;" without
conflicts/clashes/shadowing.  Russ already pointed out perldata, but
thanks anyhow. :)

> Regards,
> 
> Jeremiah
> 
> 

~Niels


Reply to: