Variable Naming [was Re: [] catching $a, $b unnecessary my and maybe other things]

Yuval Yaari yuval at
Mon Jun 7 13:47:46 PDT 2004

Shlomi, I will do some heavy snipping, let me know if I skip anything.

Shlomi Fish said:

>> Auto-completion is neither useless nor stupid.
> I agree that it isn't either.
>> Vim can auto-complete, and it's the most basic feature for an editor,
>> and it's a pure must.

I know it can, it's rather basic for a such mature editor.

> auto-completion is a nice-to-have feature, which is useful, but still
> not a  must. It was introduced rather lately in editors development. And
> not  everybody use it.

True - I just found it to cut my typing time (finger-pain? :p) without
cutting my line of thinking.
That's why I speak of it so highly (just like I do with Perl for the same
reason) :p

> Are you kidding? M-x doctor is much more useful than auto-completion.
> (just kidding)

A shrink would cost me so much, thank god for the doctor!

> Seriously now, I think I'm using a very large subset of the features of
> joe  when I use it. (or at least had when I seriously used it). So joe
> doesn't  have so many features that I don't use. In the working
> environments I grew up  with, auto-completion was not present, and so I
> did not get used to using it.  Maybe now I will.

Well, I didn't have syntax highlighting when I started to write in Perl
(because my stupid editor didn't).

>> I meant a power tool for programmers.
>> I can't think of another way to program, please open my eyes to your
>> telepathic way of programming :)
> I don't have one. At least not yet. What I meant was that one's editor
> can be  very powerful, or it can be relatively limited. A text file is a
> text file.  You can edit it with ed, pico or repetitive bash commands if
> you want, and  gcc or the Perl interpreter will still be able to process
> it and run it  correctly.

Right but if it doesn't help you program more effeciently, you should just
rm -f it.
As I wrote before, what other tools do you use when programming Perl?
I only use my editor and perl (not Perl).
My editor can do grep and cut and all the things I used to do from the
command line before I started using it.
It can also easily go into the background if I do need the command line.
Debugging is done from inside, also Devel::SmallProf for tiny
optimizations and debugging (oh, I find it as a great tool for debugging,
but that's a different issue).

Both perl and my editor are my power tools, if you see the situation.

> I was using the painter's as an analogy. I am very reluctant to call
> some  editors "powertools", as they are nice, usable and bug-free, but
> still quite  limited. But some poeple use them.

I think you should consider your editor as your power tool.
And use an editor which is a power tool.
Most popular editors are power tools (think of all their features, and
think of how many of them you know... I know maybe 1/1000th of them).

> Indeed. Does your work start at 09:00.

Working in a small company means you won't get fired for getting there at
11:00 one day if you had to go to the doctor or whatever.
Such situations occur (when I moved to my own place for example) and your
company shouldn't treat you like a robot :)
Anyone considering me as a possible employee, cover your eyes:
I used to exploit this and do some things before work like take mail (the
physical kind), drink coffee, etc.
I was nicely asked to come earlier and so I did.
That's why I said "basically". 9:00 is when I want to be there.

> Right. BTW, why are you using CamelCase for variable names? Most people
> use words_separated_by_underscore. (and I personally find it much more
> desirable).

Why are you using words separated by underscore?
Ok, not being a smart-ass: I don't care as long as I or anyone stick to
their style for an entire project.
Sometimes I use underscore separated names for variables and CamelCase for
Also sometimes it's camelCase.
I do stick with it for an entire project though, so it wouldn't confuse
Let me know about your style, I am constantly after a better one.

> Notepad does not have auto-completion, or even auto-indentation, last
> time I  checked. I installed gvim on Windows and consistently uses it
> for everything  serious. It's funny that MSIE uses notepad to view the
> source of the HTML.

Funny? It's living hell!
Can't they write something better or even steal some source code?
It would be legitimate for this specific case...

I used Windows for some project where I wanted to use Win32::IE::Mechanize.
I had a 6MB (read: small) log file.
I tried notepad - crashed my computer.
I tried wordpad - crashed my computer.
I downloaded my editor (which you know what it is but I'll shut up) and it
was really fast.

> Maybe it's possible to run the perl debugger from within gvim. I never
> really  tried. I use either perl -d (on the command line) or sometimes
> ddd (but  usually for C, and even there I mostly use plain gdb). ddd is
> a very  impressive debugging front-end (for gdb, perl -d, and other
> debuggers). But  it's quite heavyweight and written in Motif.

I use ddd.
Sometimes it shows a bad "dump" of weird data-structures.
Maybe I used an old version.

I was looking for a better debugging solution to be integrated into my
The reason is that I'm used to the keys/colors and ddd is different.
What I have comes with my editor and is nice - but it's just perl -d with
highlighting, basically.
What I'm missing is selecting a data-structure see it's "dump" on the side
(or anywhere without losing my current view of the code).

I think it's worth to explore how you can force perl -d to work from
within your editor.

> One of the most irritating things about Visual C++ is that its debugger
> does  not have a command prompt. gdb is so much faster and easier (and
> more easily  automated and customized). GUIs can seriously suck in
> comparison to CLIs some  times.

I am a bit ashamed of it, and I should change this; I do not know C/C++.
Compared to Perl, it's such a mess!
Everything takes so long to write.
Maybe it's because I never had to write something robust and/or serious
GUI applications that I never learned these 2 languages.
Good sources for the C/C++ basics are welcome in private e-mail :)

> I happen to like command line debuggers.

I get along well with perl -d.
Did I mention my Devel::SmallProf way for quick-n-dirty debugging?
You just know what lines ran and how many times (you can also `sort` on it
which is great) which usually explains a lot of things without going
through the debugging process.

> Hmmm... $laazazel_lekh_hapesh_mi_yenaanea_otkha ... ;-)

Have you been watching the comedy store lately? :)
Great show! Still funny after all those years.

> Reminds me that Joel Spolsky said a codebase he worked on once had a
> class  called FuckedString:

I like Joel, but his tips don't always fit into real-life situations.
But I honestly like his stuff :)

>> I hope the interview went well, good luck.
> It went pretty well. It involved some discussion about Perl there, but
> I'd  like to delay discussing it in public until I find out if I got the
> job or  not. (they have other candidates)

Ok - when you're rich, don't forget who told you "good luck".


More information about the Perl mailing list