I suspect that we will disagree on this then. My point was
that if you are at a point where you do not - by reflex -
get the syntax right and put the error checks in, then the
optimization question is not where you need to concentrate.
And, of course, if you do try to fix those items
then you should quickly discover my real point, which
is that error reporting with 2 of the solutions is made
much harder. That fact is one of the key reasons why it
is a bad idea to write Perl as a glorified shell.
As for whether $! was a later argument, well I don't think
so. You see I am in the habit of giving answers where you
are unlikely to see the point of the answer unless you try
it. If you try it you will discover that for yourself,
and I believe that makes it stick better. If you do not
try it, well my typing it wouldn't have helped because you
would have just forgotten that as well.
So yes, I was attempting to make it clear that dorpus
was asking the wrong question. That was not an accident,
that was the point. And I think that what I said does
help our fellow monks. Why? Because it tells them what
I think is important. I believe that if they value what
I think is important here, that will be helpful. It may
not be the help that was requested, but I am (in case you
had not noticed) someone who tries to give the help that
I think does the most good, even if it is not the help that
was asked for.
Furthermore when I first answered I gave concious thought
to the question of whether I should answer the
question as posed. You see I knew from the start that
any of the three could beat the other two in practice.
I sincerely thought about saying that up front, but I
decided that it would obscure the critical point.
And the critical point is that 99.9% of the time this is
the wrong question to ask. The remaining 0.1% of
the time, if you ask it and think carefully, you will
come to the same answer that you would have come to if
you had asked the right question in the first place.
Therefore I thought it justified to only say what I
considered to be key. Which is that until you
reflexively get the syntax right and reach for the
error check, it is more important to focus on those things
than worrying about raw performance.
Now if this undermines my credibility, then so be it.
And continuing on, you may be different, but I used to
claim that I never opened without a die in real code. But
first I realized that if I showed my pseudo-code to others
I wanted to put the die in so that they would not
accidentally copy that. Then one day I caught myself
missing that detail converting my own pseudo-code
into production code. I then sat back, thought, and made
the concious decision to always use it, even in pseudo-code,
because I didn't want to accidentally pick up and
use bad habits moving to production code.
So YMMV, but what I do in pseudo-code I tend to do in
production as well. So habits I want to have in my
production code I try to stick to in pseudo-code. | [reply] [Watch: Dir/Any] |
Ok. I can accept that. I think your point is better made, however, if you answer the question being asked first, and then explain the folly of their ways. It allows them to put the question to rest and focus on your statements, otherwise they are distracted by the fact that their question has still not been answered. But I can't force you to do that, nor would it be fair for me to try.
As for the amount of details in pseudo-code, all I can say is to each his own, or as LW put it, TIMTOWTDI. It is the wrong place to critique a persons code, because it is not code. If they fail to check a syscall in actual code, then by all means have at them. But pseudo-code isn't code - which is what makes it useful.
| [reply] [Watch: Dir/Any] |