[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] do... while?



Tushar Samant <tushar@i-works.com> writes:

> > You can tell from the prefixes where this code comes from :-)
> 
> I can't, actually. And despite what a surprisingly large number of
> people keep maintaining, it's thoroughly unreadable--I would say
> insultingly unreadable. Notice how all the ink wasted on "mnemonic"
> names necessitates many more lines, and each line does practically
> nothing. It's a snowball effect.

Think "hungarian".  Basically, you put the type, clearly described by
a simple string (such as lpsz), before the "real" variable name.

I'm not sure if it makes less sense in C (which has types, so you
introduce a redundancy and a good source for errors into your code),
or in Perl (which doesn't have Strings terminated by Zeros, or any of
the other types, and has typed data, but not variables).

It has the particular advantage that if you need to change types (even 
with compatible assignments), you're hammered.  Either you change the
name (and break old code), or you keep the old name (and describe an
error code, say, as a boolean).

I'd still like to claim that the only use for hungarian notation in
Perl is to write

	$sStr = 'a string';
	$szStr = $sStr . '0';
	$pszStr = \$szStr;

> I stared at this until it was clear that what I was going to get
> out of it wasn't all that much. I think it's a grep of a sort...
> finding the first eligible element, more precisely. Except it
> hammers the array.
> 
> I also didn't know people used names like bCheckIfThisIsAnAceFile()
> outside of parodies...

That's &bCheckIfThisIsAnAceFile(), if you don't mind.

[...]
-- 
Ariel Scolnicov        |"GCAAGAATTGAACTGTAG"            |ariels@compugen.co.il
Compugen Ltd.          |Tel: +972-2-6795059 (Jerusalem)	\  NEW IMPROVED URL!
72 Pinhas Rosen St.    |Tel: +972-3-7658520 (Main office)`--------------------
Tel-Aviv 69512, ISRAEL |Fax: +972-3-7658555  http://3w.compugen.co.il/~ariels

==== Want to unsubscribe from Fun With Perl?
==== Well, if you insist... Send mail with body "unsubscribe" to
==== fwp-request@technofile.org