Re: perl 6 grammar
Jonathan Lang wrote: Another thing to note about given ... when: you don't have to use them together. All that given does is to set $_ to the variable provided; this can be used in a manner similar to with statements in other languages. And when doesn't have to be inside a given block, either: it can be used in any block that sets $_. For example: for @list { when *..^0 { say $_ is negative } when 0 {say $_ is zero } when 0^..* { say $_ is positive } default { say $_ is something else } } or (I think): method test ($value) { setup(); when $value { doit() } #[smart-match the calling object $_ against $value.] } (Question: assuming that the above is valid, would breaking out of the when block be the same as returning from the method? Or would it qualify as an abnormal termination of the method?) I was exactly thinking at the 'with' keyword for given. Even if it is not exactly the same thing. the construct for ... when sounds more natural to me even if here it is with an array, could be : for $operator { '' {} '' {} default {} } but as Mr. Wall said, 2 different things, 2 idioms. -- シリル・デュモン(Cyrille Dumont) [EMAIL PROTECTED] our work is the portrait of ourselves tel: 03-5690-0230 fax: 03-5690-7366 http://www.comquest.co.j
Re: Pair notation for number radix
In article [EMAIL PROTECTED], Larry Wall [EMAIL PROTECTED] wrote: On Tue, Dec 04, 2007 at 08:28:48AM -0800, brian d foy wrote: : In article [EMAIL PROTECTED], Larry Wall : [EMAIL PROTECTED] wrote: : : : Later in the Literals section of S02, there's a chart of the : : corresponding forms for fat arrow, pair, and paren notation. It has : : : :a = 'foo' :afoo :a(foo) You're confusing various levels here when you say same thing. They're the same in some ways and different in others. Well, I think the documentation is confusing it. If these notations are not the same thing, should there be a table that shows the correspondence of these forms? If the pair notation shouldn't be used for adverbs, perhaps the documentation shouldn't note a generalized adverbial form of Pair notation. I guess I'll just leave it at that, though, and not bring it up again.