Larry Wall skribis 2005-04-22 18:31 (-0700): > I should point out that we're still contemplating breaking .foo() so it > no longer means $_.foo(). I wish there were more keys on my keyboard...
Which I think would be a very bad idea, so while I can (as long as no other decision has been made), I'm using the current syntax :) I even consider breaking compatibility with bare Perl 6, for my grammar, if that's necessary to get .foo to use the same implicit LHS as .[5]. Subs and loops are related, and aliasing the invocant as $_ the same way a loop aliases the loop variable as $_ makes sense to me. when you use a loop within a sub, do the same thing as when you use a loop within another loop: explicitly use the full name, or use OUTER::. > We do, after all, have better ways of declaring private methods and > functions now. so maybe we don't need to reserve _ for that anymore. I was planning on using prefixed underscore for macros that slurp up till the end of a line, so syntax highlighting could be adjusted for those things that would otherwise break. With non-underscore, I'd have to use a litter, or make my macro a prefix operator, which is more work. > And it would save two characters over $_.foo(). But recovering C > programmers will scream, and probably prefer _.foo(), even if it only > saves one character. _ on my keyboards is two keys, shift and -, while . is only one. In fact, I find $_.foo even easier to type than _.foo, and better looking. Especially because the $ sigil is part of the name now, _ without sigil should not be used. > Maybe it's time to raid Latin-1 for the next closest thing to a dot, > "middle dot": > ·say(...); > ·close or fail; Please, no. > But I'm sure some will argue that's too subtle. (Hi, @Larry<Damian>.) String index for an array? > say¹(...); > close¹ or fail; > Then foo² would be $OUTER::_.foo(), foo³ would be $OUTER::OUTER::_.foo(). For that matter, I think repeating prefixed dots works just as well: .foo # $_.foo ..foo # $OUTER::_.foo # OUTER::$_.foo ...foo # $OUTER::OUTER::_.foo # OUTER::OUTER::$_.foo This shouldn't clash with yada, I think. (In the case it does (why would it?), adding parens is an obvious way to break ambiguity: (...).) > Yes, especially the c: scheme. :-) I have no pity for Win32 users :) For all I care, they can use file:///c|/... or the awful MSIE variant file://c:\foo\bar. But I guess it's safe to treat single-letter schemes as Win32/DOS volumes, as there are no single-letter URI schemes. Juerd -- http://convolution.nl/maak_juerd_blij.html http://convolution.nl/make_juerd_happy.html http://convolution.nl/gajigu_juerd_n.html