Re: When scoping

2005-05-05 Thread Luke Palmer
On 5/4/05, Larry Wall [EMAIL PROTECTED] wrote: To get the other behavior, you have to say one of: given hello { when /hello/ { say One; when /hello/ { say Two; continue; } when /hello/ { say Three; continue; } continue;

Re: reduce metaoperator

2005-05-05 Thread Damian Conway
Luke Palmer wrote: On 5/4/05, Larry Wall [EMAIL PROTECTED] wrote: [] could mean monotonically increasing. Not unless we make boolean operators magic. There are arguments for doing that, but I don't really want to think about how that would be done at the moment. Reduce over a straight-up (or

Re: stdio

2005-05-05 Thread Larry Wall
On Thu, May 05, 2005 at 08:39:52AM +0300, Gaal Yahas wrote: : How do I open a file named -? Um, depending on what you mean, and whether we continue to support the '=' pseudofile, maybe: $fh = io(-); or $fh = open -; or $fh = $name eq '-' ?? $*IN :: open $name; : How do I open

Re: stdio

2005-05-05 Thread Gaal Yahas
On Wed, May 04, 2005 at 11:44:58PM -0700, Larry Wall wrote: : How do I open a file named -? Um, depending on what you mean, and whether we continue to support the '=' pseudofile, maybe: $fh = io(-); $fh = open -; $fh = $name eq '-' ?? $*IN :: open $name; My concern is again

Re: Open and pipe

2005-05-05 Thread Graham Barr
On May 4, 2005, at 8:13 AM, Uri Guttman wrote: AS Why? Because IO::Socket.new takes parameters that are built out of its AS entire inheritance tree, so a change to IO::Handle might radically AS modify the signature of the constructor. makes sense. we should look at the p5 IO:: tree and

Re: When scoping

2005-05-05 Thread Larry Wall
On Wed, May 04, 2005 at 11:00:46PM -0700, David Wheeler wrote: : On May 4, 2005, at 22:31 , Larry Wall wrote: : : given hello { : when /hello/ { : say One; : if /hello/ { say Two; } : if /hello/ { say Three; } : continue; : } :

Re: reduce metaoperator

2005-05-05 Thread Larry Wall
On Wed, May 04, 2005 at 11:58:59PM -0600, Luke Palmer wrote: : On 5/4/05, Larry Wall [EMAIL PROTECTED] wrote: : [] could mean monotonically increasing. : : Not unless we make boolean operators magic. There are arguments for : doing that, but I don't really want to think about how that would be

Re: Cmmposition binop

2005-05-05 Thread Michele Dondi
On Thu, 5 May 2005, Stuart Cook wrote: What I refer to now is something that takes two {coderefs,anonymous subs,closures} and returns (an object that behaves like) another anonymous sub, precisely the one that acts like the former followed by the latter (or vice versa!). Do you mean like the

Re: stdio

2005-05-05 Thread Gaal Yahas
On Thu, May 05, 2005 at 01:32:56AM -0600, Luke Palmer wrote: On 5/5/05, Gaal Yahas [EMAIL PROTECTED] wrote: getopt(...); $fh = open $in, :allowstdio; Maybe the opposite: $fh = open $in, :literal; One of the nice things about the magical - behavior is that people are

Re: stdio

2005-05-05 Thread Luke Palmer
On 5/5/05, Gaal Yahas [EMAIL PROTECTED] wrote: On Thu, May 05, 2005 at 01:32:56AM -0600, Luke Palmer wrote: And I don't think arguing in the name of security for the default case is going to buy us anything. Security doesn't come in scripts in any language for free; you have to walk

Re: reduce metaoperator

2005-05-05 Thread Leopold Toetsch
Larry Wall [EMAIL PROTECTED] wrote: It would be nice to have an easy-to-access What's this? interface that could be stitched into your favorite editor to identify what's under the cursor, or at least a command like: p6explain '[+]' s:p5/nice to have/absolutely necessary/ unless $self ~~

Re: stdio

2005-05-05 Thread Larry Wall
On Thu, May 05, 2005 at 10:14:34AM +0300, Gaal Yahas wrote: : On Wed, May 04, 2005 at 11:44:58PM -0700, Larry Wall wrote: : : How do I open a file named -? : : Um, depending on what you mean, and whether we continue to support : the '=' pseudofile, maybe: : : $fh = io(-); : $fh =

Re: When scoping

2005-05-05 Thread David Wheeler
On May 4, 2005, at 23:19 , Larry Wall wrote: You must have missed the implied ... at the end of my list of other WTDI. You can also do any of: say Two if /hello/; /hello/ say Two; /hello/ and say Two; /hello/ ?? say Two :: leave; infix:and(/hello/, { say Two }) continue

Declaration and definition of state() vars

2005-05-05 Thread Ingo Blechschmidt
Hi, sub gen() { state $svar = 42; # Only initialized once, as it is (per S04) equivalent to # state $svar will first{ 42 }; return { $svar++ }; } my $a = gen();# $svar == 42 $a(); $a(); # $svar == 44 my $b = gen();# $svar == 44 say $b(); # 44

Re: Declaration and definition of state() vars

2005-05-05 Thread Larry Wall
On Thu, May 05, 2005 at 07:50:31PM +0200, Ingo Blechschmidt wrote: : Hi, : : sub gen() { : state $svar = 42; : # Only initialized once, as it is (per S04) equivalent to : # state $svar will first{ 42 }; : return { $svar++ }; : } : : my $a = gen();# $svar == 42 :

Re: reduce metaoperator

2005-05-05 Thread John Williams
On Wed, 4 May 2005, Larry Wall wrote: It would be nice to have an easy-to-access What's this? interface that could be stitched into your favorite editor to identify what's under the cursor, or at least a command like: p6explain '[+]' That would make me extremely happy. :$sum = [+]

Re: reduce metaoperator

2005-05-05 Thread David Wheeler
On May 5, 2005, at 11:28 , John Williams wrote: How does [+] know you mean reduce infix:+, @array; instead of reduce prefix:+, @array; which is nonsense, but the [+] is in a prefix position. Because [] applies only to infix operators, as I understand it. With the hyper metaoperator, the real

Re: reduce metaoperator

2005-05-05 Thread John Williams
On Thu, 5 May 2005, David Wheeler wrote: I can see how to ask for a binary (hence infix) operator, but how do I ask for a prefix or postfix operator specifically, which + and + do? Maybe there are Operator::Prefix, etc, roles defined so you can ask for them? Ask for them for what?

Semi-related question: reduce metaoperator

2005-05-05 Thread Rob Kinyon
Can I put an operator in a variable and then use it in the [] reduce meta-operator? Something like: $op = '+'; $x = [$op] @x; Rob

Re: stdio

2005-05-05 Thread Aaron Sherman
On Thu, 2005-05-05 at 12:31, Larry Wall wrote: On Thu, May 05, 2005 at 10:14:34AM +0300, Gaal Yahas wrote: : On Wed, May 04, 2005 at 11:44:58PM -0700, Larry Wall wrote: : : How do I open a file named -? [...] : $fh = io(-); : $fh = open -; : My concern is again with magic

Re: reduce metaoperator

2005-05-05 Thread John Williams
On Thu, 5 May 2005, John Williams wrote: or even @x -= @y; Doh! That should be C $x -= $y; of course.

adverbial blocks: description and examples requested

2005-05-05 Thread Terrence Brannon
I was looking at a line in the hangman program: @letters == @solution.grep:{ $_ ne '' }; and was told that I was looking at an adverbial block. But I don't understand what that is and could not find a description and examples in a reverse search on dev and nntp.perl.org. I would appreciate

Re: adverbial blocks: description and examples requested

2005-05-05 Thread Luke Palmer
Ugh, hit a in gmail when replying! On 5/5/05, Terrence Brannon [EMAIL PROTECTED] wrote: I was looking at a line in the hangman program: @letters == @solution.grep:{ $_ ne '' }; and was told that I was looking at an adverbial block. The adverbial block is what you're giving to `if` when

Re: adverbial blocks: description and examples requested

2005-05-05 Thread Terrence Brannon
Luke Palmer [EMAIL PROTECTED] writes: Ugh, hit a in gmail when replying! On 5/5/05, Terrence Brannon [EMAIL PROTECTED] wrote: I was looking at a line in the hangman program: @letters == @solution.grep:{ $_ ne '' }; and was told that I was looking at an adverbial block. The adverbial

Re: reduce metaoperator

2005-05-05 Thread Stuart Cook
If I understand correctly, so far we have the following meta-operators: [ ] circumfix meta-operator on infix operator which produces a prefix operator circumfix meta-operator on infix operator which produces an infix operator = postfix meta-operator on infix operator which produces an infix

Re: reduce metaoperator

2005-05-05 Thread Brent 'Dax' Royal-Gordon
On 5/5/05, Stuart Cook [EMAIL PROTECTED] wrote: +-+---+-++ | Meta-op | is| operates on | to produce | +-+---+-++ | [ ] | circumfix | infix | prefix |

Re: reduce metaoperator

2005-05-05 Thread Stuart Cook
On 5/6/05, Brent 'Dax' Royal-Gordon [EMAIL PROTECTED] wrote: I find this table very interesting, in that it shows the fundamental difference between reduce and the existing meta-ops. Yep, that was basically the whole point of the table. The existing meta-operators alter the semantics of the

Re: adverbial blocks: description and examples requested

2005-05-05 Thread Ashley Winters
On 5/5/05, Terrence Brannon [EMAIL PROTECTED] wrote: I was looking at a line in the hangman program: @letters == @solution.grep:{ $_ ne '' }; and was told that I was looking at an adverbial block. But I don't understand what that is and could not find a description and examples in a