Post #126,690
11/19/03 11:14:20 AM
|
Sorry, No Sale
That would imply that you declared a variable called 'eachJob'. I'd love to see how you commented that... \n Job eachJob; // and I will describe this how?!?\n Even in this example, the Job you are working with has a specific putpose and use in the program. This purpose and use has a name, and if you enumerate that, the variable magically names itself in such a way that event the most casual observers (ar a complete idion...like me) can figure out what it does. YMMV
jb4 "There are two ways for you to have lower Prescription-drug costs. One is you could hire Rush Limbaugh's housekeeper ... or you can elect me President." John Kerry
|
Post #126,691
11/19/03 11:24:24 AM
|
That would imply that YOU don't use dynamic languages
In Perl:
for my $each_job (@job_list) { # Do something, like this... $each_job->start(); }
You will note that no declaration exists. And a comment about what you mean by a variable that is in scope for 2 lines which is clear in context is silly to the point of stupidity. (Why add the maintainance overhead if its purpose is that clear?)
Cheers, Ben
"good ideas and bad code build communities, the other three combinations do not" - [link|http://archives.real-time.com/pipermail/cocoon-devel/2000-October/003023.html|Stefano Mazzocchi]
|
Post #126,695
11/19/03 11:49:22 AM
|
What Ben said...
You need to get out more, Burns. C++ is a pretty cramped neighborhood... ;-)
Regards,
-scott anderson
"Welcome to Rivendell, Mr. Anderson..."
|
Post #126,698
11/19/03 11:53:02 AM
|
Even C++ allows defining in scope...
for (var job eachJob = .....
|
Post #126,717
11/19/03 3:12:33 PM
|
My two sense...
we usually had most logic than a simple ArrayList or Vector in our collection classes...
so: JobCollection allJobs; Job aJob; Job aProgammer; // Better still
Then: foreach (allJobs.begin(), allJobs.end(), <function call>);
(Or you could simply walk through them) for (allJobs::iterator i= allJobs.begin(); i != allJobs::iterator.end(); i++) { // DO something }
// The each aspect is implied - so it falls out.
|
Post #126,710
11/19/03 1:59:05 PM
|
Well,
I write in what I'm paid to write in. Right now that's C...with a migration to C++ in the offing.
Most of my work is in the embedded arena. The closest thing I have to a script language is the shell of whatever platform we're using for cross development (mostly Windows, which as we all know, doesn't have a shell; some work is going to happen on Linux [Hoo-RAY!], and I'm furiously learning bash, because csh sux!). Some talk of perl work; so I'll be availing myself of the collective's expertise soon enough.
Oh, yeah...and MAKE files...they're sorta a script....
We don' need no steenkin' Web services!
jb4 "There are two ways for you to have lower Prescription-drug costs. One is you could hire Rush Limbaugh's housekeeper ... or you can elect me President." John Kerry
|
Post #126,730
11/19/03 4:09:54 PM
|
Re: I write in what I get PAID to write in
Hm. I get paid to write in what I write in. Subtle difference. ;)
I truly appreciated the power of anonymity in dynamic languages today, when I wrote:
categories = {}.fromkeys(categories).keys()
which removes duplicate items from the sequence named 'categories'. The {} creates a new, anonymous dictionary, which is first populated with .fromkeys(), then immediately consumed by .keys(), which returns the list I want.
Of course, if I did this regularly, I would put it in a named function, like 'flatten' or 'dedupe' or something. But you get the idea.
I was one of the original authors of VB, and *I* wouldn't use VB for a text processing program. :-) Michael Geary, on comp.lang.python
|
Post #126,749
11/19/03 5:26:50 PM
|
You're clearly NOT a contractor, then...
jb4 "There are two ways for you to have lower Prescription-drug costs. One is you could hire Rush Limbaugh's housekeeper ... or you can elect me President." John Kerry
|
Post #126,747
11/19/03 5:14:44 PM
|
I don't.
Well, I do, but I also write in a lot of other things, too.
Because learning languages other than the ones I use at work gives me a new appreciation (or depreciation, for that matter ;-) for how they operate, and new insights into how to use them creatively to solve problems.
Regards,
-scott anderson
"Welcome to Rivendell, Mr. Anderson..."
|
Post #126,764
11/19/03 7:57:13 PM
|
must be nice to have real work
-drl
|
Post #126,793
11/19/03 11:47:21 PM
|
I'll bet it is too
FWIW
jobs do: [:each | each start].
"I believe that many of the systems we build today in Java would be better built in Smalltalk and Gemstone."
-- Martin Fowler, JAOO 2003
|