Re: Should a dirhandle be a filehandle-like iterator?

2007-04-13 Thread Yuval Kogman
Why bother, actually, when it can just be a lazy list... Opendir and closedir are very oldschool, and can be retained for whatever technical detail they are needed, but in most modern code I think that: for readdir($dir_name) { .say } should work as well. The act of opening a directory i

Re: Should a dirhandle be a filehandle-like iterator?

2007-04-13 Thread Uri Guttman
> "JL" == Jonathan Lang <[EMAIL PROTECTED]> writes: JL> Well, I did suggest that "openfile" and "opendir" exist alongside JL> "open", with "openfile" being more akin to Perl 5's "open" or JL> "sysopen", and "open" being a bit more dwimmy. JL> But in general, most of the differences th

Re: Should a dirhandle be a filehandle-like iterator?

2007-04-13 Thread Jonathan Lang
Uri Guttman wrote: > "JL" == Jonathan Lang <[EMAIL PROTECTED]> writes: JL> Please. I've always found the "opendir ... readdir ... closedir" set JL> to be clunky. JL> Also: why distinguish between "open" and "opendir"? If the string is JL> the name of a file, 'open' means "open th

Re: Should a dirhandle be a filehandle-like iterator?

2007-04-13 Thread Uri Guttman
> "JL" == Jonathan Lang <[EMAIL PROTECTED]> writes: JL> Please. I've always found the "opendir ... readdir ... closedir" set JL> to be clunky. JL> Also: why distinguish between "open" and "opendir"? If the string is JL> the name of a file, 'open' means "open the file"; if it is the

Re: Should a dirhandle be a filehandle-like iterator?

2007-04-13 Thread Jonathan Lang
Geoffrey Broadwell wrote: Jonathan Lang wrote: > Also: why distinguish between "open" and "opendir"? If the string is > the name of a file, 'open' means "open the file"; if it is the name of > a directory, 'open' means "open the directory". If it's the name of a > pipe, it opens the pipe. And

Re: Should a dirhandle be a filehandle-like iterator?

2007-04-13 Thread Geoffrey Broadwell
On Fri, 2007-04-13 at 19:00 -0700, Jonathan Lang wrote: > Please. I've always found the "opendir ... readdir ... closedir" set > to be clunky. > > Also: why distinguish between "open" and "opendir"? If the string is > the name of a file, 'open' means "open the file"; if it is the name of > a dir

Re: Should a dirhandle be a filehandle-like iterator?

2007-04-13 Thread Jonathan Lang
brian d foy wrote: As I was playing around with dirhandles, I thought "What if..." (which is actualy sorta fun to do in Pugs, where Perl 5 has everything documented somewhere even if nobody has read it). My goal is modest: explain fewer things in the Llama. If dirhandles were like filehandles, t

[svn:perl6-synopsis] r14374 - doc/trunk/design/syn

2007-04-13 Thread larry
Author: larry Date: Fri Apr 13 17:59:55 2007 New Revision: 14374 Modified: doc/trunk/design/syn/S03.pod doc/trunk/design/syn/S12.pod Log: Eliminated STATUS in favor of normal dispatch to :foo pair-handling methods. Modified: doc/trunk/design/syn/S03.pod ===

Re: File test operators as Pairs

2007-04-13 Thread brian d foy
In article <[EMAIL PROTECTED]>, Luke Palmer <[EMAIL PROTECTED]> wrote: > However, now we have stat($file).size. That's sorta fine with me. That makes it even easier to explain to newbies, although I'd need method names for the other tests. However, junctive tests are a mighty attractive featur

Should a dirhandle be a filehandle-like iterator?

2007-04-13 Thread brian d foy
As I was playing around with dirhandles, I thought "What if..." (which is actualy sorta fun to do in Pugs, where Perl 5 has everything documented somewhere even if nobody has read it). My goal is modest: explain fewer things in the Llama. If dirhandles were like filehandles, there's a couple of pa

Re: File test operators as Pairs

2007-04-13 Thread Brandon S. Allbery KF8NH
On Apr 13, 2007, at 20:09 , Jonathan Lang wrote: What does pair notation buy us that quoted-postfix notation doesn't already cover? I don't think it does. What it does buy is that the *unquoted* notation works: the definition of Perl6's grammar turns out to lead to `-f' and `- f' parsin

Re: File test operators as Pairs

2007-04-13 Thread Jonathan Lang
Luke Palmer wrote: These things are methods, and I'm not sure why we've crammed them into smart match. Things like :M have nothing to do with matching. What would it mean if smart match returned false? "This file has not been modified ever"? :e has a bit more merit for a smart match, but the op

Re: [S03] Negation metaoperator

2007-04-13 Thread Larry Wall
On Thu, Apr 05, 2007 at 11:07:12PM -0700, Jonathan Lang wrote: : Generalize the negated relational operators to apply to any infix : operator that returns a boolean. In terms of the standard operators, : this will add <&& || ^^ // and or xor err> to the family that is : implicitly equipped with lo

[perl #41894] segfault happens when invoking poll op

2007-04-13 Thread Nuno Carvalho via RT
Greetings, On Wed Mar 21 20:49:36 2007, coke wrote: > The following patch avoids the segfault: > > Index: src/io/io.c > = > == > --- src/io/io.c (revision 17678) > +++ src/io/io.c (working copy) > @@ -1325,6 +1325,9 @@ > INTVAL > P

Re: Fun Stats from sloccount

2007-04-13 Thread Joshua Gatcomb
On 4/13/07, chromatic <[EMAIL PROTECTED]> wrote: The numbers would be higher if sloccount recognized Parrot code. I might add that shortly. -- c Totals grouped by language (dominant language first): ansic: 194913 (51.89%) perl:167865 (44.69%) I reccently informed the author

[svn:perl6-synopsis] r14373 - doc/trunk/design/syn

2007-04-13 Thread larry
Author: larry Date: Fri Apr 13 16:23:17 2007 New Revision: 14373 Modified: doc/trunk/design/syn/S03.pod Log: Ranges over enums and such also can use *, suggested by Jonathan Lang++ Modified: doc/trunk/design/syn/S03.pod

Fun Stats from sloccount

2007-04-13 Thread chromatic
The numbers would be higher if sloccount recognized Parrot code. I might add that shortly. -- c Totals grouped by language (dominant language first): ansic: 194913 (51.89%) perl:167865 (44.69%) java: 3908 (1.04%) tcl: 3228 (0.86%) yacc: 2369 (0.63%) lex:

re: Re: Using a Regex object

2007-04-13 Thread philcrow
Moritz Lenz <[EMAIL PROTECTED]> wrote: Hi, [EMAIL PROTECTED] wrote: Can someone point me to the docs or code where I can find out how to use that Regex object (or to the proper list or channel in which to ask)? I'm hoping the regex is going to contained my named captures. It's in S05: http://p

Re: File test operators as Pairs

2007-04-13 Thread Luke Palmer
On 4/13/07, brian d foy <[EMAIL PROTECTED]> wrote: Which then makes me think I'd want to do something a bit wacky to see if the modtime is greater than 5: "doc" ~~ M => any( 5 ..* ); Or even "doc" ~~ M => (5..*). Then again, ("doc" ~~ :M) ~~ 5..* does the same thing, without having to hav

File test operators as Pairs

2007-04-13 Thread brian d foy
So far (eep!), the documentation talks about file test operators as working with pairs, which will be a weird thing to explain, I guess. I'm wondering if this matters to the mere user at all, and if we should even talk about them in terms of "pairs". I don't want a different set of terms in the doc

Re: What should file test operators return?

2007-04-13 Thread brian d foy
In article <[EMAIL PROTECTED]>, Mark J. Reed <[EMAIL PROTECTED]> wrote: > I think I need to reread the docs. What's the colon in the method calls for? > > (That is, why is it $stat_obj.:r instead of just $stat_obj.r ?) I can't answer the "why" question, but the stuff in S02 might help you. Look

Re: What should file test operators return?

2007-04-13 Thread Mark J. Reed
I think I need to reread the docs. What's the colon in the method calls for? (That is, why is it $stat_obj.:r instead of just $stat_obj.r ?) On 4/13/07, brian d foy <[EMAIL PROTECTED]> wrote: In article <[EMAIL PROTECTED]>, Larry Wall <[EMAIL PROTECTED]> wrote: > On Thu, Apr 12, 2007 at 01:52

Re: What should file test operators return?

2007-04-13 Thread brian d foy
In article <[EMAIL PROTECTED]>, Larry Wall <[EMAIL PROTECTED]> wrote: > On Thu, Apr 12, 2007 at 01:52:50PM -0500, brian d foy wrote: > : Here's my code example that motivates this question. For a Llama6 > : exercise with file test operators, I wanted to create a little table: > : > :for @fil

Re: What should file test operators return?

2007-04-13 Thread Larry Wall
On Thu, Apr 12, 2007 at 01:52:50PM -0500, brian d foy wrote: : At the moment the file test operators that I expect to return true or : false do, but the true is the filename. You've just dug up a pugsian fossil. : I expected a boolean, for no : other reason than Perl 6 has them so it might as wel

Re: [svn:parrot] r18180 - trunk/src/io

2007-04-13 Thread chromatic
On Friday 13 April 2007 09:44, [EMAIL PROTECTED] wrote: > Log: > [src/io] > * prevent segmentation fault when calling poll on null PMC (RT#41894 for > details) Hm, every time I fix one of these, I wonder if there's a better place to prevent it. What's the code flow look like to get to this poi

Re: What should file test operators return?

2007-04-13 Thread Larry Wall
On Fri, Apr 13, 2007 at 08:01:13PM +1000, Damian Conway wrote: : Maybe there also needs to be a "boolean" conversion for printf : (perhaps %t for true?): Seems insufficiently general. However, I note that booleans are an enum, and by default stringify to Bool::True or Bool::False. Maybe %t stands

[svn:perl6-synopsis] r14372 - doc/trunk/design/syn

2007-04-13 Thread larry
Author: larry Date: Fri Apr 13 10:02:01 2007 New Revision: 14372 Modified: doc/trunk/design/syn/S03.pod Log: Clarification of simplified return values of filetests for brian.d.foy++. Modified: doc/trunk/design/syn/S03.pod ==

Re: Does =$*ARGS work?

2007-04-13 Thread David Vergin
on 4/13/2007 4:55 AM brian d foy said the following: > Shouldn't $*ARGS still show up as the P6 counterpart to ARGV? > S*ARGS as the filehandle shows up in S04. Yup. Fixed now in S28draft.pod. Mention in Variable.pod will follow. dvergin

Re: What should file test operators return?

2007-04-13 Thread Brandon S. Allbery KF8NH
On Apr 13, 2007, at 9:04 , brian d foy wrote: In article <[EMAIL PROTECTED]>, Brandon S. Allbery KF8NH <[EMAIL PROTECTED]> wrote: File tests are supposed to return something which: - behaves as a Bool - stringifies as a filename - numifies as a file size or as a time, if appropriate - propag

Re: What should file test operators return?

2007-04-13 Thread brian d foy
In article <[EMAIL PROTECTED]>, Moritz Lenz <[EMAIL PROTECTED]> wrote: > Hi, > > brian d foy wrote: > > At the moment the file test operators that I expect to return true or > > false do, but the true is the filename. > > that helps chaining of file test: > > $fn ~~ :t ~~ :x > or something. I

Re: What should file test operators return?

2007-04-13 Thread brian d foy
In article <[EMAIL PROTECTED]>, Moritz Lenz <[EMAIL PROTECTED]> wrote: > brian d foy wrote: > > At the moment the file test operators that I expect to return true or > > false do, but the true is the filename. > that helps chaining of file test: > > $fn ~~ :t ~~ :x > or something. That's fine,

Re: What should file test operators return?

2007-04-13 Thread brian d foy
In article <[EMAIL PROTECTED]>, Brandon S. Allbery KF8NH <[EMAIL PROTECTED]> wrote: > File tests are supposed to return something which: > - behaves as a Bool > - stringifies as a filename > - numifies as a file size or as a time, if appropriate > - propagates a stat object (obviating perl5's mag

Re: Does =$*ARGS work?

2007-04-13 Thread brian d foy
In article <[EMAIL PROTECTED]>, David Vergin <[EMAIL PROTECTED]> wrote: > on 4/11/2007 10:29 AM brian d foy said the following: > > The $*ARGS variable shows up in this file, which looks like it's still > > maintained: > > http://svn.pugscode.org/pugs/docs/AES/S28draft.pod > > That's a typ

Re: What should file test operators return?

2007-04-13 Thread brian d foy
In article <[EMAIL PROTECTED]>, Brandon S. Allbery KF8NH <[EMAIL PROTECTED]> wrote: > On Apr 12, 2007, at 14:52 , brian d foy wrote: > > > At the moment the file test operators that I expect to return true or > > false do, but the true is the filename. I expected a boolean, for no > > other reaso

Re: What should file test operators return?

2007-04-13 Thread Brandon S. Allbery KF8NH
On Apr 12, 2007, at 14:52 , brian d foy wrote: At the moment the file test operators that I expect to return true or false do, but the true is the filename. I expected a boolean, for no other reason than Perl 6 has them so it might as well use them. This is documented somewhere already. Pugs

Re: What should file test operators return?

2007-04-13 Thread John Macdonald
On Fri, Apr 13, 2007 at 10:29:43AM +0100, Moritz Lenz wrote: > Hi, > > brian d foy wrote: > > At the moment the file test operators that I expect to return true or > > false do, but the true is the filename. > > that helps chaining of file test: > > $fn ~~ :t ~~ :x > or something. > If you want

Re: Synopsis 26

2007-04-13 Thread Damian Conway
Version 0.0.3 of the Perl6::Perldoc suite is now on CPAN. I've ripped out the previous, extremely brittle, test suite and replaced it with a much larger one whose tests are fully abstracted, declarative, and OO (and hence may be useful to other Perl 6 implementors as well). The new tests don't

Re: Does =$*ARGS work?

2007-04-13 Thread David Vergin
on 4/11/2007 10:29 AM brian d foy said the following: The $*ARGS variable shows up in this file, which looks like it's still maintained: http://svn.pugscode.org/pugs/docs/AES/S28draft.pod That's a typo (mine). It should be @*ARGS and refers to simple access to the command line arguments

Re: What should file test operators return?

2007-04-13 Thread Juerd Waalboer
Damian Conway skribis 2007-04-13 20:01 (+1000): > Maybe there also needs to be a "boolean" conversion for printf > (perhaps %t for true?): I often use "[ ]" and "[X]" to represent true and false in text output. They resemble checkboxes. I don't think printf needs a boolean output template, but it

Re: What should file test operators return?

2007-04-13 Thread Damian Conway
On 13/04/07, Moritz Lenz <[EMAIL PROTECTED]> wrote: If you want a boolean, use ? $fn ~~ :x or something. Definitely "or something". Unary ? has the wrong precedence there. You could write: for @files -> $file { printf "%-70s %s %s %s\n", $file, true $file ~~

Re: What should file test operators return?

2007-04-13 Thread Moritz Lenz
Hi, brian d foy wrote: > At the moment the file test operators that I expect to return true or > false do, but the true is the filename. that helps chaining of file test: $fn ~~ :t ~~ :x or something. If you want a boolean, use ? $fn ~~ :x or something. HTH, Moritz -- Moritz Lenz http://morit

What should file test operators return?

2007-04-13 Thread brian d foy
At the moment the file test operators that I expect to return true or false do, but the true is the filename. I expected a boolean, for no other reason than Perl 6 has them so it might as well use them. The section on Smart Matching in S03 says that the ~~ doesn't have to return a boolean, but asi

Re: [perl #42475] [PATCH] Change asm() to __asm__()

2007-04-13 Thread chromatic
On Thursday 12 April 2007 09:53, Steve Peters wrote: > -ansi -pedantic choke on the call to asm() in src/ops/core.ops. This is > because asm() is gcc-builtin. However, if you use __asm_() instead, > everything works just fine. The following patch gets Parrot to compile > just file, although rat

Re: [perl #42474] [PATCH] Remove dangling enum commas

2007-04-13 Thread chromatic
On Thursday 12 April 2007 09:25, Steve Peters wrote: > Unlike Perl lists, commas are not allowed to be dangling in enum lists. > The attached patch removes them. Thanks, applied as r18175. -- c