Re^3: Pugs Tic Tac
by japhy (Canon) on Apr 25, 2005 at 17:31 UTC
|
What has the single ''?'' been usurped for?? I can''t remember.. Or is the problem that ""everyone wants the colon"",, so a doubled colon was needed,, leading to a doubled question mark??
| [reply] |
|
I think it was the colon, yeah. I could be wrong -- my memory on this is a bit hazy -- but I seem to remember the trinary operator is what prevented the single colon from being used before. Doubling the colon requires doubling the question mark to look reasonably balanced.
And funnily enough, I didn't realize you had doubled all your punctuation until after I had read your reply a second or third time. I almost spit soda all over my keyboard because of that. :-)
Update: from Exegesis 3:
The ?? and :: are the new way we write the old ?: ternary operator in Perl 6. Larry had to change the spelling because he needed the single colon for marking adverbs. But it's a change for the better anyway --it was rather odd that all the other short-circuiting logical operators (&& and || and //) used doubled symbols, but the conditional operator didn't. Well, now it does. The doubling also helps it stand out better in code, in part because it forces you to put space around the :: so that it's not confused with a package name separator.
| [reply] |
|
The doubling also helps it stand out better in code, in part because it forces you to put space around the :: so that it's not confused with a package name separator.
Aha! Another sneaky instance of required whitespace! (What will this do to golf scores?)
-QM
--
Quantum Mechanics: The dreams stuff is made of
| [reply] |
|
Ok, thanks for reminding me. I knew the answer would be in some Exegesis somewhere...
| [reply] |
Re^3: Pugs Tic Tac
by cog (Parson) on Apr 25, 2005 at 19:33 UTC
|
You use it often enough that two extra characters makes you say "yuck"?
I do.
I mean, it works exactly the same. It looks nearly exactly the same. It just has two of each character instead of one.
It's an increase of 100%, you know? :-)
But please note: I'm not saying that I'm against the change or anything. With time, I'll probably enjoy it. I just wanted to make it perfectly clear that some people use the ternary operator a lot.
And I'm proudly one of them :-)
print "$users user", ( $users == 1 ? '' : 's'), " currently use the ternary operator.\n";
| [reply] [d/l] |
|
to be completely gramatically correct, you've got to modify the verb as well ;-)
print "$users user", ( $users == 1 ? '' : 's'),
" currently use",( $users == 1 ? 's' : ''),
" the ternary operator.\n";
| [reply] [d/l] |
|
| [reply] |
|
Ok, I knew I should have avoided the appeal to frequent use. That always lands me in hot water, because for every feature there is bound to be at least one person who uses it all the time. Of course, the trinary operator is probably used frequently by quite a bit more than one person, but you know. :-)
| [reply] |