On Tue, Mar 25, 2003 at 09:25:30PM -0500, 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.
Perl programmers are the odd lot because $data and @data are two
different variables with the name "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;
}
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.