On Mon, Aug 11, 2008 at 11:34:03AM -0600, Tom Christiansen wrote: : >I'm still somewhat ambivalent about this, myself. My previous : >experience with hyphens in identifiers is chiefly in languages that : >don't generally have algebraic expressions, e.g. LISP, XML, so it will : >take some getting used to in Perl. But at least in Perl's case the : >subtraction conflict is mitigated by the fact that many subtraction : >expressions will involve sigils; $x-$y can't possibly be a single : >identifier. : : People use nonadic functions (nonary operators? where non = 0, not 9) : without parens, and get themselves into trouble for it. : : % perl -E 'say time-time' : 0 : : % perl -E 'say time-do{sleep 3; time}' : -3 : : % perl -E 'say time +5' : 1218475824 : : % perl -E 'say time -5' : 1218475817 : : % perl -E 'say time(-5)' : syntax error at -e line 1, near "(-" : Execution of -e aborted due to compilation errors. : Exit 19
The thing that convinced me this was a good idea is that it corresponds pretty closely to what English orthography uses. The thing that convinced me it's not a bad idea is that it is almost certain that the compiler will catch any mistakes because it's strict. In that context, the question of how often people will make such mistakes is a secondary consideration. I was reassured on the apostrophe score that the entire test suite only made the new "mistake" twice. I'll have a better idea about the frequency of hyphen mistakes once STD implements symbol tables and complains about undefined subs, which will catch flubs like "time-time" or "time-do". On the subject of 0-ary functions, there's no entire solution, but one of the things we are doing is getting rid of all the 0-or-1-ary functions which only add to the confusion. For instance, rand is now 0-ary only, and to get something other than a number in the range 0..^1 you must use something like: rand*100 100.rand (1..100).pick And, in fact, if you say "rand 100" the current STD grammar complains: Obsolete use of rand(N); in Perl 6 please use N.rand or (1..N).pick instead Larry