Re: RFC: Filehandle type-defining punctuation

2000-08-07 Thread Ted Ashton
Thus it was written in the epistle of Bart Lateur, > On Fri, 4 Aug 2000 10:03:28 -0400, Ted Ashton wrote: > > >If we've decided that chomp isn't going to return the clippings, would it not > >seem prudent to make > > while (chomp()) > > > >work like > > while () > > You mean, like, the -l com

Re: RFC: Filehandle type-defining punctuation

2000-08-06 Thread Jonathan Scott Duff
On Sat, Aug 05, 2000 at 08:53:58PM +, Nick Ing-Simmons wrote: > You loose one little thing - you have a new scalar (the handle) > > with > > open $fh,$filename > > one can re-use an existing thing to which someone else may have a reference. > (Not that that is useful very often.) Well per

Re: RFC: Filehandle type-defining punctuation

2000-08-05 Thread Nick Ing-Simmons
Nathan Wiger <[EMAIL PROTECTED]> writes: >> Um, what stops open returning undef on failure (and setting $!), so I could do >> >> $fh = open $filename or die "open $filename failed: $!\n"; > >Exactly. You don't lose anything because open() will still return "true" >(a handle) or "false" (

Re: RFC: Filehandle type-defining punctuation

2000-08-05 Thread Bart Lateur
On Fri, 4 Aug 2000 10:03:28 -0400, Ted Ashton wrote: >If we've decided that chomp isn't going to return the clippings, would it not >seem prudent to make > while (chomp()) > >work like > while () You mean, like, the -l command line switch? (see perlrun) chomp() on input, append newlines on p

Re: RFC: Filehandle type-defining punctuation

2000-08-04 Thread Nathan Torkington
Tom Christiansen writes: > perl526 Good grief, Tom! How many versions of Perl ahead of us are you?! Nat :-)

Re: RFC: Filehandle type-defining punctuation

2000-08-04 Thread Ted Ashton
Thus it was written in the epistle of Tom Christiansen, > >How often does the return value from chomp or chop get used? The confusion > >would cleared up considerably, I think, if they didn't return a value. > > Seldom, I think--albeit sufficiently often that you might want the > perl526 transla

Re: RFC: Filehandle type-defining punctuation

2000-08-04 Thread Piers Cawley
Tom Christiansen <[EMAIL PROTECTED]> writes: > >But that, precisely, was my point: Arrays *and* hashes. If there is more than > >one plural whatzitz, then why can't there be more than one singular whatzitz? > >(and don't say, "because plural *means* more than one" :-). If having a > >filehandl

Re: RFC: Filehandle type-defining punctuation

2000-08-04 Thread Tom Christiansen
>How often does the return value from chomp or chop get used? The confusion >would cleared up considerably, I think, if they didn't return a value. Seldom, I think--albeit sufficiently often that you might want the perl526 translator to have any such found be converted to some kind of lchop/lcho

Re: RFC: Filehandle type-defining punctuation

2000-08-04 Thread Tom Christiansen
>> Some related issues: >> >> 1) Did Larry or did he not mention something about dealing with >>indirect object more cleanly? >Maybe clarify this just a little. I don't think I was present for this >discussion. That's just the indirect object slot ambuiguity annoyance. See the OO c

Re: RFC: Filehandle type-defining punctuation

2000-08-04 Thread Johan Vromans
Ted Ashton <[EMAIL PROTECTED]> writes: > How often does the return value from chomp or chop get used? # Remove possible trailing slash. $file .= $possible_slash if ($possible_slash = chop($file)) ne "/"; Of course, TMTOWTDI. -- Johan

Re: RFC: Filehandle type-defining punctuation

2000-08-03 Thread Ted Ashton
Thus it was written in the epistle of Nathan Wiger, > I don't know of an easy solution. I don't think we should touch chomp or > chop. Maybe someone should write a module that offers alternate versions > for those that want them? How often does the return value from chomp or chop get used? The c

Re: RFC: Filehandle type-defining punctuation

2000-08-03 Thread Nathan Wiger
> I think I'd prefer that ->pid return 0 only to the child of a fork, > but undef on a handle that were not the product of a fork, irrespective > of direction. Great analysis. I think this sounds like an excellent idea. > Some related issues: > > 1) Did Larry or did he not mention somethin

Re: RFC: Filehandle type-defining punctuation

2000-08-03 Thread Nathan Wiger
> The suggestion was the open() return a filehandle object, so may > I suggest > >$fh = open("| cat -v | sort | lpr") or die ; >$pid = $fh->pid; I like. I'll add it. Version 2's gonna be *huge*... -Nate

Re: RFC: Filehandle type-defining punctuation

2000-08-03 Thread Nathan Wiger
> I'd've written that more like > > $data_axed = chop($var); > $charcount = chomp($var); > > Or something. People really do find those two functions confusing. > Is this something we'd like to address by having versions that don't > take LVALUES? I don't know. It is true that this is s

Re: RFC: Filehandle type-defining punctuation

2000-08-03 Thread John Porter
Larry Wall wrote: > > Sorry, beat you to it, barely. Camel III, page 10: > > (If you look carefully at the % character, you can see the key > and the value with a slash between them. It may help to squint.) If I squint one way, I see an "H"; and if I squint another way, I see "a/a"!

Re: RFC: Filehandle type-defining punctuation

2000-08-03 Thread Glenn Linderman
If the file handle becomes an object, they'd be available via member functions of the object for those that are curious, would they not? And if it is less than an object, a function could be provided to obtain a pid from a handle. Tom Christiansen wrote: > >It seems that this issue is definitel

Re: RFC: Filehandle type-defining punctuation

2000-08-03 Thread Graham Barr
On Thu, Aug 03, 2000 at 07:11:00AM -0600, Tom Christiansen wrote: > $fh = open("|-") || die "can't start pipeline: $!"; > > if ($fh->pid) { > print $fh "stuff\n"; > } else { > $data = readline $fh; > } > > I think I'd prefer that ->pid return 0 only to the child of

Re: RFC: Filehandle type-defining punctuation

2000-08-03 Thread Tom Christiansen
>The suggestion was the open() return a filehandle object, so may >I suggest > $fh = open("| cat -v | sort | lpr") or die ; > $pid = $fh->pid; Let's see how that plays out with pipe open: if ($fh = open("| cat -v | sort | lpr")) { print $fh "stuff\n"; } else { di

Re: RFC: Filehandle type-defining punctuation

2000-08-03 Thread Graham Barr
On Thu, Aug 03, 2000 at 06:27:13AM -0600, Tom Christiansen wrote: > >It seems that this issue is definitely worth a quick RFC - something > >like "proposal to return filehandles from open/opendir rather than supply > >as arguments". > > What about the pids that come back from begotten processes,

Re: RFC: Filehandle type-defining punctuation

2000-08-03 Thread Tom Christiansen
>Point taken, I did actually think of most of these. The difference is >all of these return something still: > $object = tie %hash, $class; > $chopped = chop($var); > $chomped = chomp($var); > $ref = bless {}, $class; I'd've written that more like $data_axed = chop($var); $

Re: RFC: Filehandle type-defining punctuation

2000-08-03 Thread Tom Christiansen
>It seems that this issue is definitely worth a quick RFC - something >like "proposal to return filehandles from open/opendir rather than supply >as arguments". What about the pids that come back from begotten processes, as in open(FILTER, "| cat -v | sort | lpr") or open(MESELF, "|-")

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Tim Jenness
On Wed, 2 Aug 2000, Nathan Wiger wrote: > Tom Christiansen wrote: > > > > >Not sure I agree with that. I think one point of confusion / perceived > > >difference between filehandles, open(), and basically every other > > >builtin is that all the others *return* what you want. > > > > tie and b

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Nathan Wiger
> Yes, but then each of those has to be explained specially. People > *expect* assignment to "autovivify", as it were. But open() et al > are essentially a 3rd syntax for constructors, and that's about one > syntax too many, give or take a few. I agree with this. I think of open() a lot more li

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Nathan Wiger
Tom Christiansen wrote: > > >Not sure I agree with that. I think one point of confusion / perceived > >difference between filehandles, open(), and basically every other > >builtin is that all the others *return* what you want. > > tie and bless and chop and chomp also all act upon their argumen

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Larry Wall
Tom Christiansen writes: : >Not sure I agree with that. I think one point of confusion / perceived : >difference between filehandles, open(), and basically every other : >builtin is that all the others *return* what you want. : : Think of all the {file,dir}handle syscalls. They don't do that.

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Tom Christiansen
>Not sure I agree with that. I think one point of confusion / perceived >difference between filehandles, open(), and basically every other >builtin is that all the others *return* what you want. tie and bless and chop and chomp also all act upon their argument(s). Just to name a few. bless ha

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Tom Christiansen
>Not sure I agree with that. I think one point of confusion / perceived >difference between filehandles, open(), and basically every other >builtin is that all the others *return* what you want. Think of all the {file,dir}handle syscalls. They don't do that. They autoviv an object. --tom

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Nathan Wiger
Tom Christiansen wrote: > > >Except that you can test for failure by checking to see if $fh is defined. > > Let your true be true and your false be false. > > open($fh, "<", $filename) || die; > > --tom Not sure I agree with that. I think one point of confusion / perceived difference betw

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Nathan Wiger
> Um, what stops open returning undef on failure (and setting $!), so I could do > > $fh = open $filename or die "open $filename failed: $!\n"; Exactly. You don't lose anything because open() will still return "true" (a handle) or "false" (undef). -Nate

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Tom Christiansen
> Thanks for the advice. Would "production" have been less likely to offend >than "real-world"? Perhaps. Or "conservative". Or "cautious". Or "paranoid". :-) --tom

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Ted Ashton
Thus it was written in the epistle of Tom Christiansen, > >Doesn't print 'GLOB' for me, but that's because a lot of real-world systems > ^^ > >haven't hit 5.6.0 (I'm guessing, not absolutely sure that's the cause), > > If you look at

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Michael Stevens
On Wed, Aug 02, 2000 at 08:00:57PM -0600, Tom Christiansen wrote: > >Doesn't print 'GLOB' for me, but that's because a lot of real-world systems > ^^ > >haven't hit 5.6.0 (I'm guessing, not absolutely sure that's the cause), > If you

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Tom Christiansen
>Doesn't print 'GLOB' for me, but that's because a lot of real-world systems ^^ >haven't hit 5.6.0 (I'm guessing, not absolutely sure that's the cause), If you look at it, you'll notice that "real" is here being used as something o

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Tom Christiansen
>Except that you can test for failure by checking to see if $fh is defined. Let your true be true and your false be false. open($fh, "<", $filename) || die; --tom

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Peter Scott
At 10:36 AM 8/3/00 +0900, Simon Cozens wrote: >On Wed, Aug 02, 2000 at 04:26:56PM -0700, Nathan Wiger wrote: > > I tend to agree with Tom's argument here. open() is kind of funny > > anyways. Why couldn't it work like this, similar to FileHandle: > > > >$fh = open $filename; > >Testing for fai

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Tim Jenness
On Thu, 3 Aug 2000, Simon Cozens wrote: > On Wed, Aug 02, 2000 at 04:26:56PM -0700, Nathan Wiger wrote: > > I tend to agree with Tom's argument here. open() is kind of funny > > anyways. Why couldn't it work like this, similar to FileHandle: > > > >$fh = open $filename; > > Testing for fail

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Simon Cozens
On Wed, Aug 02, 2000 at 04:26:56PM -0700, Nathan Wiger wrote: > I tend to agree with Tom's argument here. open() is kind of funny > anyways. Why couldn't it work like this, similar to FileHandle: > >$fh = open $filename; Testing for failure. It's a basic tenet that system calls can be tested

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Nathan Wiger
> No: lists are the plural whatzitzes, containing zero or more singular > whatzitzes. They are ordered. Arrays hold lists. I tend to agree with Tom's argument here. open() is kind of funny anyways. Why couldn't it work like this, similar to FileHandle: $fh = open $filename; print $fh "so

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Michael Stevens
On Wed, Aug 02, 2000 at 06:28:47PM -0600, Tom Christiansen wrote: > >I'd also like some 'what are you' introspection I can do on all scalars, on > >a more formal basis than 'ref'. Either an expansion of the 'ref' functionality > >to cover filehandles, or a more general system... > What do you mean

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Larry Wall
Peter Scott writes: : At 06:28 PM 8/2/00 -0600, Tom Christiansen wrote: : >ref() has always been a de facto typeof operator, no? : > : > open my $fh, "< /etc/motd"; : > print ref $fh : >GLOB : : Can we make that IO in P6...? Maybe, but it might be some class derived from an IO object, de

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Peter Scott
At 06:28 PM 8/2/00 -0600, Tom Christiansen wrote: >ref() has always been a de facto typeof operator, no? > > open my $fh, "< /etc/motd"; > print ref $fh >GLOB Can we make that IO in P6...? -- Peter Scott Pacific Systems Design Technologies

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Tom Christiansen
>I'd also like some 'what are you' introspection I can do on all scalars, on >a more formal basis than 'ref'. Either an expansion of the 'ref' functionality >to cover filehandles, or a more general system... What do you mean, "formal"? ref() has always been a de facto typeof operator, no? o

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Tom Christiansen
>If the prefix-less form of filehandles was absent from Perl 6, I would be >far less enthusiastic about my RFC. I agree; they're a kind of scalar. >(Just occurred to me that one could view the % prefix of hashes as denoting >a key-value pair by virtue of looking like two o's separated by a >d

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Larry Wall
Peter Scott writes: : If the prefix-less form of filehandles was absent from Perl 6, I would be : far less enthusiastic about my RFC. I agree; they're a kind of scalar. In fact, they're a kind of object. : (Just occurred to me that one could view the % prefix of hashes as denoting : a key-val

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Michael Stevens
On Wed, Aug 02, 2000 at 02:51:20PM -0400, John Porter wrote: > Peter Scott wrote: > > Filehandles should use C<*> as a type prefix if typeglobs are eliminated. > I missed previous discussion of this (if there was any), > but it's an idea I've already thought about. > It has my vote, fwiw. I have

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Peter Scott
If the prefix-less form of filehandles was absent from Perl 6, I would be far less enthusiastic about my RFC. I agree; they're a kind of scalar. (Just occurred to me that one could view the % prefix of hashes as denoting a key-value pair by virtue of looking like two o's separated by a divide

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Ted Ashton
Thus it was written in the epistle of Tom Christiansen, > > What about regexes? > > $foo = qr/blech/; > > Should that be /foo instead? :-) > > Notice how even objects use $, not something else. <*chuckle*> Ok, point conceded. Ted -- Ted Ashton ([EMAIL PROTECTED]), Info Sys, Southern

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Tom Christiansen
>Scalars, hashes, arrays. There's actually more than one type of plural here, >gramatically: >scalars hashes arrays >singulardualplural >(Or am I the only one left who did Ancient Greek? :) Nope: pudge and larry, at least. >> (and don't say, "because plural *means* more

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Simon Cozens
On Wed, Aug 02, 2000 at 05:31:06PM -0400, Ted Ashton wrote: > But that, precisely, was my point: Arrays *and* hashes. Scalars, hashes, arrays. There's actually more than one type of plural here, gramatically: scalars hashes arrays singulardualplural (Or am I the only one l

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Tom Christiansen
>> No: lists are the plural whatzitzes, containing zero or more singular >> whatzitzes. They are ordered. Arrays hold lists. >I tend to agree with Tom's argument here. open() is kind of funny >anyways. Why couldn't it work like this, similar to FileHandle: > $fh = open $filename; > print $

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Tom Christiansen
>But that, precisely, was my point: Arrays *and* hashes. If there is more than >one plural whatzitz, then why can't there be more than one singular whatzitz? >(and don't say, "because plural *means* more than one" :-). If having a >filehandle character would make the code clearer, then let's do

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Ted Ashton
Thus it was written in the epistle of Jon Ericson, > Ted Ashton wrote: > > Thus it was written in the epistle of Tom Christiansen, > > > Nope. A filehandle is a singular whatzitz. It thus mandatory takes > > > the singular prefix; to wit, $. What's next? Integer and float and > > > complex and

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Jon Ericson
Ted Ashton wrote: > Thus it was written in the epistle of Tom Christiansen, > > Nope. A filehandle is a singular whatzitz. It thus mandatory takes > > the singular prefix; to wit, $. What's next? Integer and float and > > complex and string and char and bits prefixes? > > (Weighing in with th

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Ted Ashton
Thus it was written in the epistle of Tom Christiansen, > >Hearing no outright derision in response to my trial balloon, here it is as > >an RFC: > > >=head1 TITLE > > >Filehandles should use C<*> as a type prefix if typeglobs are eliminated. > > Nope. A filehandle is a singular whatzitz. It

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Steve Simmons
On Wed, Aug 02, 2000 at 11:46:15AM -0700, Peter Scott wrote: > =head1 TITLE > > Filehandles should use C<*> as a type prefix if typeglobs are eliminated. I could go for this, given the `if typeglobs are eliminated' caveat.

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread Tom Christiansen
>Hearing no outright derision in response to my trial balloon, here it is as >an RFC: >=head1 TITLE >Filehandles should use C<*> as a type prefix if typeglobs are eliminated. Nope. A filehandle is a singular whatzitz. It thus mandatory takes the singular prefix; to wit, $. What's next? Int

Re: RFC: Filehandle type-defining punctuation

2000-08-02 Thread John Porter
Peter Scott wrote: > Filehandles should use C<*> as a type prefix if typeglobs are eliminated. I missed previous discussion of this (if there was any), but it's an idea I've already thought about. It has my vote, fwiw. -- John Porter

RFC: Filehandle type-defining punctuation

2000-08-02 Thread Peter Scott
Hearing no outright derision in response to my trial balloon, here it is as an RFC: =head1 TITLE Filehandles should use C<*> as a type prefix if typeglobs are eliminated. =head1 VERSION Maintainer: Peter Scott <[EMAIL PROTECTED]> Date: 2 Aug 2000 Version: 1 Mailing List: perl6-la