I often use the logical operators && || and or as stand-ins for if (){};. Their short-circuit behavior is a handy idiom for conditionals.
I sometimes struggle with how to pronounce them. I always say 'and' and 'or' to myself and I know what I mean. How can they be said to others?
In English, 'do{} or die' is correctly understood by everyone. This extends to most ..or die; constructions in perl. The trouble is that it's the 'die' part that is recognised. The logical structure is swamped by the cliche.
A m// && print; sequence is second nature to perl programmers. What do you say when you read it out loud to nonperlers? To sugarcoat plain "match and print", I've used:
When the predicate is just a flag, it's helpful to make it a gerund or noun ( $production || $debugging && print;), but what verbs make the meaning of that clear in spoken language?
I wonder whether other languages provide more precision in these matters, too
After Compline,
Zaxo
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Spoken Perl: and && or what?
by tachyon (Chancellor) on Jul 29, 2001 at 17:39 UTC | |
Re: Spoken Perl: and && or what?
by Masem (Monsignor) on Jul 29, 2001 at 15:27 UTC | |
Re (tilly) 1: Spoken Perl: and && or what?
by tilly (Archbishop) on Jul 30, 2001 at 07:19 UTC | |
Re: Spoken Perl: and && or what?
by synapse0 (Pilgrim) on Jul 29, 2001 at 13:39 UTC | |
by John M. Dlugosz (Monsignor) on Jul 30, 2001 at 02:58 UTC | |
by ChemBoy (Priest) on Jul 30, 2001 at 08:17 UTC | |
by John M. Dlugosz (Monsignor) on Jul 30, 2001 at 09:08 UTC | |
by John M. Dlugosz (Monsignor) on Jul 30, 2001 at 23:23 UTC | |
Re: Spoken Perl: and && or what?
by VSarkiss (Monsignor) on Jul 30, 2001 at 02:31 UTC | |
Re: Spoken Perl: and && or what?
by John M. Dlugosz (Monsignor) on Jul 30, 2001 at 02:56 UTC | |
Re: Spoken Perl: and && or what?
by mugwumpjism (Hermit) on Jul 29, 2001 at 17:24 UTC |