Adam Turoff wrote:
> Benjamin Goldberg wrote:
>> Adam Turoff wrote:
>>> On Mon, Mar 24, 2003 at 08:21:51PM -0500, Benjamin Goldberg wrote:
>>>> And what happens if a programmer wants to have two different
>>>> variables, of two different types, with the same name, such as
>>>> @data and %data?
>>>>
>>>> Without sigils, it cannot be done.
>>>
>>> Vast numbers of C, C++, C#, Java, Python, Lisp, APL, FORTRAN, Forth,
>>> COBOL, Shell, Basic, ASM, Pascal, Modula-*, Oberon, Smalltalk,
>>> Ruby, Ada, Tcl, Icon, SNOBOL and Objective C programmers have been
>>> quite productive for many man-millenia without this capability.
>>
>> Really?  Then why does the following C program:
>>
>> int main(int arg_count, char * arg_vec[]) {
>>    int foo;
>>    double foo;
>>    return 0;
>> }
>>
>> Produce an error when I try and compile it?
> 
> Because it's ambiguous.  You're proving my point, not refuting it.

Sorry -- I misread.  Somehow, I thought you were saying that it could be
done in those languages, when you were actually saying that those
languages don't have it and noone's ever felt it to be a lack.

> Perl programmers are the odd lot because $data and @data are two
> different variables with the name "data".

Actually, if they're dynamic variables, then they're both one variable,
named *data, and they're accessing different portions of the *data
thingy.

If they're lexicals, *then* they're two different variables... though
I'm not entirely certain how they're internally named.  PadWalker
presents them as variables named '$data' and '@data'.

> Virtually[*] every other programming language doesn't allow this, and
> programmers using those languages don't have a problem finding names
> other than "foo" and "bar" for their variables.
> 
> I've never come across a programmer who wishes he could do this
> in C and have the compiler magically know what's what:
> 
>         int spam (int spam, char **spam) {
>                 int eggs;
>                 double spam;
>                 return 0;
>         }

Well... What if you were to write this as:

   int f_spam(int i_spam, char **p_p_c_spam) {
      int i_eggs;
      double d_spam;
      return 0;
   }

Surely that would be legible, right?

Except, of course, that since this is perl, we spell 'f_' as '&', and
'i_' and 'd_' as '$', and 'p_' as '@'.

> Z.
> 
> [*] Now that I think about it, there are many languages in the BASIC
>     family.  Some of them use sigil suffixes, but recent and modern
>     ones don't.  Basic-PLUS probably did, since it influenced Perl.

-- 
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "[EMAIL PROTECTED]
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}

Reply via email to