Re: enhanced open-funktion

2004-08-06 Thread Jonadab the Unsightly One
Juerd [EMAIL PROTECTED] writes: Not a problem, assuming that these are named arguments as in: open :r, $file; open :w, $file; open :rw, $file; open :r :w, $file; # Hmm... I like this approach. :a seems a probable replacement for $file then; one imagines that :a would be

Re: enhanced open-funktion

2004-07-17 Thread Jonadab the Unsightly One
Luke Palmer [EMAIL PROTECTED] writes: my $fh = open $filename :excl; Can we please not name it with a random character generator? How about something that communicates what it does in some fashion, at least well enough to function as a mnemonic? my $fh = open $filename :rw :noreplace;

Re: enhanced open-funktion

2004-07-17 Thread Jonadab the Unsightly One
Larry Wall [EMAIL PROTECTED] writes: 1 .. (some_big_hairy_expression) ^:by(3) But we'd have to pay really close attention to how indenting is done. Maybe we should just pass this suggestion on to Guido... :-) Yes, please leave column-alignment tricks to Python. I don't even

Re: enhanced open-funktion

2004-07-15 Thread Michele Dondi
On Tue, 13 Jul 2004, Juerd wrote: open '', $foo; open '', $foo; is much harder to read than open 'r', $foo; open 'w', $foo; Are you sure?!? I would tend to disagree... not that MHO is particularly important, I guess, but just to stress the fact that it is by large a

Re: enhanced open-funktion

2004-07-15 Thread Greg Boug
On Thursday 15 July 2004 19:42, Michele Dondi wrote: open '', $foo; open '', $foo; is much harder to read than open 'r', $foo; open 'w', $foo; Are you sure?!? I would tend to disagree... not that MHO is particularly important, I guess, but just to stress the fact

Re: enhanced open-funktion

2004-07-15 Thread H.Merijn Brand
On Thu 15 Jul 2004 11:42, Michele Dondi [EMAIL PROTECTED] wrote: On Tue, 13 Jul 2004, Juerd wrote: open '', $foo; open '', $foo; is much harder to read than open 'r', $foo; open 'w', $foo; Are you sure?!? I would tend to disagree... So do I. , and are

Re: enhanced open-funktion

2004-07-15 Thread Juerd
H.Merijn Brand skribis 2004-07-15 11:57 (+0200): 1. They do not ambiguate with files named 'r', or 'w' Not a problem, assuming that these are named arguments as in: open :r, $file; open :w, $file; open :rw, $file; open :r :w, $file; # Hmm... 2. They don't have to be

Re: enhanced open-funktion

2004-07-15 Thread Juerd
Greg Boug skribis 2004-07-15 20:01 (+1000): open FH, |/usr/bin/foo; I'd love to be rid of -| and |-. I always have to RTFM to know which one is which. open :r :p, '/usr/bin/foo'; # Or :read :pipe open :rp, '/usr/bin/foo';# IIRC, rules also let you combine

Re: enhanced open-funktion

2004-07-15 Thread Smylers
Greg Boug writes: I have always felt that keeping ['' and ''] the same as shell scripting was a handy thing, ... Using C:w and C:r would at least match what C:w and C:r do in 'Vi' ... Smylers

Re: enhanced open-funktion

2004-07-15 Thread Austin Hastings
--- Smylers [EMAIL PROTECTED] wrote: Using C:w and C:r would at least match what C:w and C:r do in 'Vi' ... That seems intuitive: my $fh = open 'foo.txt', :w; $fh.say Hello, world!; $fh = open 'foo.txt', :e;# Ha, ha, just kidding! $fh.say -EOF If wifey shuns Your fond

Re: enhanced open-funktion

2004-07-15 Thread Brent 'Dax' Royal-Gordon
Greg Boug wrote: I have always felt that keeping it the same as shell scripting was a handy thing, especially when I have been teaching it to others. It also makes the ol' perl5 open FH, |/usr/bin/foo; make a lot more sense. Using something like open p, /usr/bin/foo; just

Re: enhanced open-funktion

2004-07-15 Thread Juerd
Brent 'Dax' Royal-Gordon skribis 2004-07-15 13:04 (-0700): $in=open :r |/usr/bin/foo; $out=open :w |/usr/bin/foo; $both=open :rw |/usr/bin/foo; No, thank you. Please let us not repeat the mistake of putting mode and filename/path in one argument. [EMAIL PROTECTED]:~/tmp/example$

Re: enhanced open-funktion

2004-07-15 Thread Smylers
Brent 'Dax' Royal-Gordon writes: My personal preference is for: $in=open :r |/usr/bin/foo; The pipe would be legal on either side of the string. This would still allow the often-useful type a pipe command at a prompt for a file, And it still allows for all those security holes in

Re: enhanced open-funktion

2004-07-14 Thread Larry Wall
On Tue, Jul 13, 2004 at 03:44:11PM -0600, John Williams wrote: : On Tue, 13 Jul 2004, Larry Wall wrote: : On Tue, Jul 13, 2004 at 07:24:55AM -0600, Luke Palmer wrote: : : But in Perl 6, you don't have to specify things like that through the : : mode string: you can specify them through named

enhanced open-funktion

2004-07-13 Thread perl6-all-return-52158-archive=jab . org
Hello, I have a wish for Perl 6. I would like if the open-funktion opens only a file if it doesn't exist. Of course, I can first test if the file exist. if (-e $filename) { print file already exists!; } else { open (FH, $filename) } My suggestion is to have a character for the

Re: enhanced open-funktion

2004-07-13 Thread Luke Palmer
[EMAIL PROTECTED] writes: Hello, I have a wish for Perl 6. I would like if the open-funktion opens only a file if it doesn't exist. Of course, I can first test if the file exist. if (-e $filename) { print file already exists!; } else { open (FH, $filename) } My

Re: enhanced open-funktion

2004-07-13 Thread Michele Dondi
On Tue, 13 Jul 2004 [EMAIL PROTECTED] wrote: I have a wish for Perl 6. I would like if the open-funktion opens only a file if it doesn't exist. Of course, I can first test if the file exist. I rather have a much bigger wish for an open-like operator that to be fair I would like to see

Re: enhanced open-funktion

2004-07-13 Thread Michele Dondi
On Tue, 13 Jul 2004, Michele Dondi wrote: I rather have a much bigger wish for an open-like operator that to be Of course that should be function. I'm thinking of an operator that returns a magical FH working like the

Re: enhanced open-funktion

2004-07-13 Thread Jonathan Scott Duff
On Tue, Jul 13, 2004 at 03:41:54PM +0200, Michele Dondi wrote: On Tue, 13 Jul 2004 [EMAIL PROTECTED] wrote: I have a wish for Perl 6. I would like if the open-funktion opens only a file if it doesn't exist. Of course, I can first test if the file exist. I rather have a much bigger

Re: enhanced open-funktion

2004-07-13 Thread Michele Dondi
On Tue, 13 Jul 2004, Jonathan Scott Duff wrote: I rather have a much bigger wish for an open-like operator that to be fair I would like to see *also* in Perl5: nothing that one can do in well more than one way in any case (also including creating a module that will ^

Re: enhanced open-funktion

2004-07-13 Thread Austin Hastings
--- Larry Wall [EMAIL PROTECTED] wrote: While that probably works, I think better style would be to use a comma: my $fh = open $filename, :excl; That explicitly passes :excl to open as a term in a list rather than relying on the magical properties of :foo to find the preceding

Re: enhanced open-funktion

2004-07-13 Thread Larry Wall
On Tue, Jul 13, 2004 at 10:41:32AM -0700, Austin Hastings wrote: : --- Larry Wall [EMAIL PROTECTED] wrote: : While that probably works, I think better style would be to use a : comma: : : my $fh = open $filename, :excl; : : That explicitly passes :excl to open as a term in a list

Re: enhanced open-funktion

2004-07-13 Thread Juerd
Luke Palmer skribis 2004-07-13 7:24 (-0600): But in Perl 6, you don't have to specify things like that through the mode string: you can specify them through named parameters: my $fh = open $filename :excl; I was hoping we could finally get rid of mode characters, and especially combined

Re: enhanced open-funktion

2004-07-13 Thread Larry Wall
On Tue, Jul 13, 2004 at 09:25:52PM +0200, Juerd wrote: : Luke Palmer skribis 2004-07-13 7:24 (-0600): : But in Perl 6, you don't have to specify things like that through the : mode string: you can specify them through named parameters: : my $fh = open $filename :excl; : : I was hoping we

Re: enhanced open-funktion

2004-07-13 Thread Juerd
Larry Wall skribis 2004-07-13 14:04 (-0700): The combined form is definitely problematic in various ways, and we haven't really redesigned open yet, since we haven't got to A29 yet. :-) Well, open being much like IO::All::io would really make me happy. That is: my $fh = open 'foo.txt';

Re: enhanced open-funktion

2004-07-13 Thread John Williams
On Tue, 13 Jul 2004, Larry Wall wrote: On Tue, Jul 13, 2004 at 07:24:55AM -0600, Luke Palmer wrote: : But in Perl 6, you don't have to specify things like that through the : mode string: you can specify them through named parameters: : : my $fh = open $filename :excl; While that