http://qs321.pair.com?node_id=96837


in reply to Re: Dots and cargo-cult programming
in thread Dots and cargo-cult programming

Yeah, I don't like the dot. Here's why:

When I first started with Perl, I had only used the dot occassionally in C and Javascript. When it came time to learn Perl's arrow, it was relatively easy: whereas a dot suggests termination, both as period and (US) decimal, the arrow suggests action, i.e. $object->does_something. This is the basic reason I hate the dot. Essentially, it throws off the natural-language written text parser in my head, in a way that is diametrically opposed to its normal use. (Is there any modern written human language out there that does not use the period as the default mark for terminating utterances? Has anyone involved with human-computer interaction/usability testing ever examined the usability of the semantics assigned to semicolons, brackets and other "line noise" ascii in different computer languages? Besides the ongoing sniping over white space vs. brackets?)

But now, thanks to Java, VB, and other languages, the dot is the Dominant Programming Convention, and we, the valiant hold-out programmers who know better, are doomed. Doomed! Doomed, I say! Or should that be

$we = $I.say("Doomed!" x3);

Damian assured me that the Grand Poobah's mind is set, and our fate is sealed. And he cajoled me that it wouldn't be so bad, getting used to using dots instead of arrows; that he had been against it, tried it, and after a while it was no big deal. He convinced me, reluctantly, because ultimately that line of code above isn't so bad. He also gave me this really yummy blue pill.

Plus, I wouldn't call this "cargo cult programming". That's about propagating ignorance. This seems to me to be a matter of a concession to convention, when the convention's hold reaches a critical mass and when the convention is suboptimal but not abhorrent. And I definitely wouldn't go that far.

Anyway, I'm actually much more concerned about =~ vs ~= right now. Dot vs. arrow is a nuisance, but that's potentially lethal, and at the least I hope it's dealt with intelligently by perl6's warnings.

-- Frag.

Replies are listed 'Best First'.
Re: How I Learned to Stop Worrying and Tolerate the Dot
by petdance (Parson) on Jul 15, 2001 at 18:16 UTC
    I wouldn't call this "cargo cult programming"

    The point of the original poster wasn't that the dot was cargo cult programming, but that it encouraged people to cut 'n' paste VB code into Perl programs, because there was no translation of the -> to a .

    xoxo,
    Andy
    --
    <megaphone> Throw down the gun and tiara and come out of the float! </megaphone>

      I guess I was trying to say that I don't think that permitting cut'n'paste is itself the motivating factor for the change. I got the impression from Damian's comments that it's about reducing one factor that might daunt (does daunt?) Veebians, Javanese, etc. when trying to use Perl, by giving in to the common convention.

      Also, now that I think about it, I don't think there's anything wrong with using example code, and I don't think that's the same as cargo cult. Everyone does it from time to time (raise your hand if you own the Cookbook) especially when starting out on a new topic. The question is, will you stop with that? Will you let the example persist unmodified into production, without bothering to figure out what it's doing?

      I think this is mostly a matter who you are - whether you've got the drive to understand, and take pride in your work. I think it was Socrates who said "The unexamined code is not worth executing", but there are plenty of people who wouldn't properly examine their code no matter what language they're using. Making conversion of VB code into Perl easier, by itself, IMHO, won't encourage cargo cult any more than the Cookbook does now.

      -- Frag.

Re: How I Learned to Stop Worrying and Tolerate the Dot
by nysus (Parson) on Jul 15, 2001 at 23:13 UTC
    I belive the real source of the problem is the lack of non-alphanumeric symbols in ASCII. We all know Wall was pretty meticulous picking right symbols. So how on earth did he arrive at "." for concatenation? As you say, "." is pretty universal for "stop". Personally, I think "." and "->" both suck for different reasons. It's a choice between a lesser of two evils and there ain't much you can do about it.

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar Abbot Bishop";
    $nysus = $PM . $MCF;
    Click here if you love Perl Monks

      That's a good point. I'm so used to it by now that I haven't considered how weird it is to use '.' as concat. I think it's because I've grown to think of the Perl5 dot as like a decimal point, in that the two parts of the number have to be adjacent to each other.

      -- Frag.

      Yes, so many things we think of as normal now were caused by a lack of characters in ASCII and its predicesors. Why not use × for multiplication and ÷ for division, since they are in the common Latin-1 8-bit character set? I mean, isn't it time we moved beyond 7 bits?

      Now we think of * as meaning multiply, when originally it was an available substitute because character 0xD7 didn't exist yet.

      You could also use → for dereference and ← for assignment (as early Algol-family languages originally wanted!), if only the fonts weren't drawn so terribly.

      —John

      Hmm... I know that's worked before, so why are characters with high bit set (multi-byte in UTF-8 encoding) showing up as sequences in the preview window? Looking at HTML source, there is no meta tag for charset present. Works fine as entities, though, but much harder to type!