[2366] in java-interest
Re: main() routine
daemon@ATHENA.MIT.EDU (Philip Brown)
Fri Sep 29 22:36:32 1995
To: cmcmanis@scndprsn.eng.sun.com (Chuck McManis)
Date: Fri, 29 Sep 1995 17:01:06 -0700 (PDT)
Cc: phil@bolthole.com, java-interest@java.Eng.Sun.COM
In-Reply-To: <9509291949.AA02423@pepper.Eng.Sun.COM> from "Chuck McManis" at Sep 29, 95 12:49:31 pm
From: phil@bolthole.com (Philip Brown)
[ Chuck McManis writes ]
>
>
> I guess I didn't make myself clear, the Java paradigm for programming is
> nothing at all like the one used in C and C++ programs.
> ...
> The fact that the command 'java' instantiates my class and invokes main doesn't
> mean that the StringBuffer class might also invoke the main method in my class.
> (it doesn't of course but it could).
Okay, sure. so argv[0] should contain the class name.
(the class name that contains main(), that is)
Yes, I know the caller already knows this, and the class already knows this.
This is a just a small feature to make the world at large have an
easier time transitioning.
> Argv[0] in C represented the "containing"
> environmental (program). After you've used Java for a while you'll figure that
> out too and then (if we changed it) you would complain that everytime you declared
> a static main method with an array of strings the system allocates some worthless
> string in array element zero.
You could be saying ont of two things there:
1. I would complain about "wasted" memory. If that were the case,
don't allocate it. Just cheat and make it a pointer to wherever the
class stores its "true name".
2. Once I use java enough, I will forget all about the C/C++ convention,
that argv[0] is useless, and argv[1] is the first arg.
This is not going to happen. I am going to continue to use C++ as well as
java.
And even if I WERE to "convert" fully, there are thousands of programmers
out there who are also going to have to deal with this, who are right where
I am now.
yeuck.
>
> In UNIX the power was:
> % ls -l | sort | awk '{ ...}' |uniq | ...
>
> That is constructing commands from the combination of other commands. In Java
> this is replaced by:
> System.out.print(new Uniqifier(new Awker(new Sorter(new FileLister("."), BYSIZE), "awker")));
>
yaya. fine. I took lisp. I know all about that kind of syntax :-)
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com