RFC 58 (v1) C changes.

2000-08-16 Thread Syloke Soong
chomp should have options to define what an EOL is. Many times, on Solaris, I could not use chomp because I had to use =~ s/[\n\r ]$// on files that came from NT or even from MS-oriented unix editors.

Re: RFC 58 (v1) C changes.

2000-08-16 Thread Stephen P. Potter
Lightning flashed, thunder crashed and Nathan Wiger <[EMAIL PROTECTED]> whisper ed: | I suggest a modification to this RFC: if chomp() is called without args, | it modifies $_ directly, consistent with its current implementation. | That way you can write: If it is called without args, it really i

RE: RFC 58 (v1) C changes.

2000-08-09 Thread Bryan C . Warnock
On Wed, 09 Aug 2000, Brust, Corwin wrote: > So, kids, whatcha doing with that return value? (the number of characters > removed by the operation)? Store it (in paragraph mode) so I know how many \n's to append back on when spitting the output back. (Provided that matters. Otherwise, I just ign

Re: RFC 58 (v1) C changes.

2000-08-09 Thread Dan Sugalski
At 07:19 PM 8/9/00 +0200, Johan Vromans wrote: >Dan Sugalski <[EMAIL PROTECTED]> writes: > > > So? It's an op. Lists can be passed any way we want. :) > >In what respect would that be different from a function? >(cf. RFC 26). Ops are lower level. (I'm not talking about, say, the localtime op, but

Re: RFC 58 (v1) C changes.

2000-08-09 Thread Johan Vromans
Dan Sugalski <[EMAIL PROTECTED]> writes: > So? It's an op. Lists can be passed any way we want. :) In what respect would that be different from a function? (cf. RFC 26). -- Johan

Re: RFC 58 (v1) C changes.

2000-08-09 Thread Chaim Frenkel
> "UG" == Uri Guttman <[EMAIL PROTECTED]> writes: UG> and the globals can be used by the magic <> which was asked by jonathan UG> scott. when you use <> you rarely IMO use many other handles. typically UG> <> is used in filter programs. Personal counter example. Many times, I take multiple i

RE: RFC 58 (v1) C changes.

2000-08-09 Thread Brust, Corwin
The Perl 6 Librarian writes >=head1 DESCRIPTION > >This RFC contains two proposed changes. First, as it is common to want to >removed newlines upon reading a file, > > while (chomp()) { >. . . > } > >should become the equivalent of > > while () { >chomp; >. . . > } > >where th

Re: RFC 58 (v1) C changes.

2000-08-09 Thread Nathan Torkington
John Porter writes: > Being explicit about when you want your lines chomped is more > consistent, IMHO, than always getting it whether you want it or not. I'm getting the feeling that this discussion should either end or become an RFC. Soon. Nat

Re: RFC 58 (v1) C changes.

2000-08-09 Thread John Porter
Bart Lateur wrote: > > There's no need for that macho "I can lick this" attitude. Being > consistent, everywhere, is clearly simpler. Being explicit about when you want your lines chomped is more consistent, IMHO, than always getting it whether you want it or not. [irrelevant timings of perl5 c

Re: RFC 58 (v1) C changes.

2000-08-09 Thread Bart Lateur
On Wed, 9 Aug 2000 10:24:28 -0400, John Porter wrote: >Bart Lateur wrote: >> >> It's not "simple". It's confusing. > >Not at all! At least, not to me. If you find it unsimple and confusing, >then I guess I'll have to chalk it up to the heterogeneity of the Perl >community. >> Very often I do

Re: RFC 58 (v1) C changes.

2000-08-09 Thread John Porter
Bart Lateur wrote: > > It's not "simple". It's confusing. Not at all! At least, not to me. If you find it unsimple and confusing, then I guess I'll have to chalk it up to the heterogeneity of the Perl community. > Very often I do stuff like you > describe, and then it turns out that there a

Re: RFC 58 (v1) C changes.

2000-08-09 Thread Dan Sugalski
At 09:24 AM 8/9/00 -0400, John Porter wrote: >Dan Sugalski wrote: > > > unless you think we should require arrays to be passed by reference. > > > > It's an op. Arrays can be passed in any way we want. > >But as I already pointed out, we don't want to pass just arrays, >we need to be able to pass

Re: RFC 58 (v1) C changes.

2000-08-09 Thread Graham Barr
On Tue, Aug 08, 2000 at 08:53:30PM -0400, Dan Sugalski wrote: > On Tue, 8 Aug 2000, Michael Mathews wrote: > > > Dan Sugalski said: > > > > > * Do we even want to allow after-the-fact chomps, or do it > > automagically > > > >at read time? > > > "Yes" is rather ambiguous. > > > > To clarify: "Ye

Re: RFC 58 (v1) C changes.

2000-08-09 Thread Bart Lateur
On Wed, 9 Aug 2000 09:23:02 -0400, John Porter wrote: >That is way too simplistic. I for one think the current behavior >of chomp() is ideal for its simplicity. > > while(<>) { > /foo/ and next; # why bother chomping? > if ( /bar/ ) { > pr

Re: RFC 58 (v1) C changes.

2000-08-09 Thread John Porter
Dan Sugalski wrote: > > unless you think we should require arrays to be passed by reference. > > It's an op. Arrays can be passed in any way we want. But as I already pointed out, we don't want to pass just arrays, we need to be able to pass any LIST. -- John Porter

Re: RFC 58 (v1) C changes.

2000-08-09 Thread John Porter
Bart Lateur wrote: > > chomp() is basically just a "postprocess data coming from a file" > command. That is way too simplistic. I for one think the current behavior of chomp() is ideal for its simplicity. while(<>) { /foo/ and next; # why bother chomping?

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Dan Sugalski
On Tue, 8 Aug 2000, Michael Mathews wrote: > Ted Ashton said: > > Thus it was written in the epistle of Uri Guttman, > > > > > > how do you tell the above two apart? by array do you mean only an array > > > variable? then you can't chomp a list of scalar values or multiple > > > arrays, etc. > >

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Dan Sugalski
On Tue, 8 Aug 2000, Michael Mathews wrote: > Dan Sugalski said: > > > > * Do we even want to allow after-the-fact chomps, or do it > automagically > > >at read time? > > "Yes" is rather ambiguous. > > To clarify: "Yes", we (I) want to allow after-the-fact chomps. As you > alluded to yourself the

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Bart Lateur
On Tue, 8 Aug 2000 18:35:46 -0400, Michael Mathews wrote: >I frequently use chomp in ways that have nothing to do with "reading from >files" and I would bet this is true for everyone here too. For example: > >use CGI; >$cgi = new CGI; >$foo = $cgi->param('foo'); > >#as part of doing stuff to the

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Michael Mathews
Bart Lateur said: > So what are these really good for? To get rid of the line terminator, or > "Record Separator", when reading from a file. That is what they are for, > that is what we should facilitate. Not the chop()ping or chomp()ing of > just any string. > > So, let's keep in tune with the R

Re: RFC 58 (v1) C changes.

2000-08-08 Thread John Porter
Michael Mathews wrote: > > Like "join" the order of arguments would have to be "chomp($thing_to_remove, > @array)" but this spoils the default behavior of $thing_to_remove being > optional... > > unless you think we should require arrays to be passed by reference. Well, if we were really talkin

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Michael Mathews
Ted Ashton said: > Thus it was written in the epistle of Uri Guttman, > > > > how do you tell the above two apart? by array do you mean only an array > > variable? then you can't chomp a list of scalar values or multiple > > arrays, etc. > > > > this needs to be clarified. > > Quite true. The two

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Mike Pastore
On Tue, 8 Aug 2000, Bart Lateur wrote: > All you'd have to do, is set a boolean flag on the "filehandle object", > saying: "Oi, I want this chomped.". For example: > > $fh->chomped(1); > > Then, what <$fh> would do, is read one line, looking for whatever line > end it accepts, finish wher

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Mike Pastore
Ugh, I'm being foolish. Let me clarify. map { s/\r\n/ } @chomp_me; would do the trick, for lists of things that need to be chomped. Perhaps just a modification to the map function is needed, to support things like: for(map { s/\r\n/ } $fh) { print; } or maybe bind chomp to a new prototype

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Bart Lateur
On Tue, 8 Aug 2000 10:12:49 -0700 (PDT), Larry Wall wrote: >If chomp exists in Perl 6 at all, I think it would >have to be some kind of method call on the string that figures out what >the discipline determined to be the terminator *for the current line*. >(Note that under Unicode, we might well

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Mike Pastore
On Tue, 8 Aug 2000, Ted Ashton wrote: > > Quite true. The two-argument one is new to me and I hadn't thought much > about it. Do you have a suggestion? Hmm, chomp { /\r\n/ } @chomp_me; ala p5 map, grep, and sort? -- Mike Pastore [EMAIL PROTECTED]

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Ted Ashton
Thus it was written in the epistle of Uri Guttman, > > how do you tell the above two apart? by array do you mean only an array > variable? then you can't chomp a list of scalar values or multiple > arrays, etc. > > this needs to be clarified. Quite true. The two-argument one is new to me and I

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Uri Guttman
> "TA" == Ted Ashton <[EMAIL PROTECTED]> writes: TA> One-argument chomp(): TA> array: TA> chomp()s each element of array using $/? TA> two-argument chomp(): TA> does as above, but using the second argument (which is a scalar, not a TA>regex) how do you te

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Ted Ashton
Thus it was written in the epistle of Uri Guttman, > > if a ref to a scalar, it chomps in place. return the ref? the chomped > char count? . . . the point of the RFC was to propose making chomp()'s behaviour change depending on context. Here's the summary so far as I can tell: One-argument cho

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Uri Guttman
> "MM" == Michael Mathews <[EMAIL PROTECTED]> writes: >> >What about a > chomp($foo, '\r\n'); > # or > chomp(, '\r\n'); >> >syntax. >> >> Looks an awful lot like: s/\r\n//; to me... MM> Yep. It should-- that's all chomp does afterall. The difference is MM> that the proposed chom

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Michael Mathews
Dan Sugalski said: > > > * Do we even want to allow after-the-fact chomps, or do it automagically > >at read time? > "Yes" is rather ambiguous. To clarify: "Yes", we (I) want to allow after-the-fact chomps. As you alluded to yourself there are times when you may want to chomp strings that were no

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Ted Ashton
Thus it was written in the epistle of Brust, Corwin, > > From: Ted Ashton [mailto:[EMAIL PROTECTED]] > >> I don't particularly mind the last two - in fact they add some benefits > >> (like not modifying the original), which are nice to have. However, that > >> first one, frankly, drives me nuts.

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Dan Sugalski
At 02:29 PM 8/8/00 -0400, Michael Mathews wrote: >Dan Sugalski said: > > Which brings up the questions: > > > > * What about scalars that didn't come from filehandles? > > * Should the chomp function use the filehandle's current separator, or the > > one in effect when it was read? > > * Do we eve

RE: RFC 58 (v1) C changes.

2000-08-08 Thread Brust, Corwin
From: Ted Ashton [mailto:[EMAIL PROTECTED]] >> I don't particularly mind the last two - in fact they add some benefits >> (like not modifying the original), which are nice to have. However, that >> first one, frankly, drives me nuts. > >Please reread the proposal. chomp() called in void context

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Uri Guttman
> "TA" == Ted Ashton <[EMAIL PROTECTED]> writes: TA> Thus it was written in the epistle of Jonathan Scott Duff, >> On Tue, Aug 08, 2000 at 01:56:12PM -0400, Uri Guttman wrote: > a >> couple of ideas. one, i proposed we keep a global $/ and $\ for > >> default use by handles which have

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Jonathan Scott Duff
On Tue, Aug 08, 2000 at 02:16:57PM -0400, Ted Ashton wrote: > I, for one, would like to know where the assumption came from that there would > be no default filehandle. I believe Larry said he was probably going to axe it. > Is it necessary that instead of typing > > print 'Hello World.';

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Michael Mathews
Dan Sugalski said: > Which brings up the questions: > > * What about scalars that didn't come from filehandles? > * Should the chomp function use the filehandle's current separator, or the > one in effect when it was read? > * Do we even want to allow after-the-fact chomps, or do it automagically

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Ted Ashton
Thus it was written in the epistle of Jonathan Scott Duff, > On Tue, Aug 08, 2000 at 01:56:12PM -0400, Uri Guttman wrote: > > a couple of ideas. one, i proposed we keep a global $/ and $\ for > > default use by handles which haven't set their own. > > Rather than having global $/ and $\, each fil

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Jonathan Scott Duff
On Tue, Aug 08, 2000 at 01:56:12PM -0400, Uri Guttman wrote: > a couple of ideas. one, i proposed we keep a global $/ and $\ for > default use by handles which haven't set their own. Rather than having global $/ and $\, each filehandle has their's defaulted to something reasonable. > two, instea

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Ted Ashton
Thus it was written in the epistle of Larry Wall, > Before we get too carried away discussing the syntax of chomp, let's > look a bit at the semantics. What's chomp supposed to work on if we > make $/ go away? Right. But that's not yet decided :-). > I think any discussion of

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Ted Ashton
Thus it was written in the epistle of Nathan Wiger, > > Second, as it seems common for someone learning perl to expect > > > > $without_newline = chomp($previous_form); > > This proposal seeks to make things more consistent, which is good, but > at the expense of being less usable, which is ba

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Uri Guttman
> "LW" == Larry Wall <[EMAIL PROTECTED]> writes: LW> Before we get too carried away discussing the syntax of chomp, LW> let's look a bit at the semantics. What's chomp supposed to work LW> on if we make $/ go away? I think any discussion of chomp without LW> considering how the inpu

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Dan Sugalski
At 10:12 AM 8/8/00 -0700, Larry Wall wrote: >Ted Ashton writes: >: Thus it was written in the epistle of Segher Boessenkool, >: > >: > The magic defined($_ = ) only happens if is the only thing >: > inside while(). >: > >: > In this case, it's not (there's a chomp() inside as well), so the magic

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Nathan Wiger
> Second, as it seems common for someone learning perl to expect > > $without_newline = chomp($previous_form); This proposal seeks to make things more consistent, which is good, but at the expense of being less usable, which is bad. For example, these: chomp; chomp(@file); chomp($val

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Larry Wall
Larry Wall writes: : (Note that under Unicode, we might well have one line terminated with a : line separator, and the next line terminated with a page separator, and Make that paragraph separator. Larry

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Larry Wall
Ted Ashton writes: : Thus it was written in the epistle of Segher Boessenkool, : > : > The magic defined($_ = ) only happens if is the only thing : > inside while(). : > : > In this case, it's not (there's a chomp() inside as well), so the magic : > doesn't apply. : : Ok. One more time . . .

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Ted Ashton
Thus it was written in the epistle of Segher Boessenkool, > > The magic defined($_ = ) only happens if is the only thing > inside while(). > > In this case, it's not (there's a chomp() inside as well), so the magic > doesn't apply. Ok. One more time . . . I'm proposing that we change that.

Re: RFC 58 (v1) C changes.

2000-08-08 Thread Segher Boessenkool
> I guess that's not yet clear to me. After all, as I had pointed out to me, > > while() > > means > > while (defined($_ = )) > > not > > while ($_ = ) > > even if the chomp() is handed an empty line, it will return a defined value. > Only at the point at which returns undef will the whi

Re: RFC 58 (v1) C changes.

2000-08-07 Thread Ted Ashton
Thus it was written in the epistle of Bart Lateur, > On 7 Aug 2000 16:06:44 -, Perl6 RFC Librarian wrote: > > >This RFC contains two proposed changes. First, as it is common to want to > >removed newlines upon reading a file, > > > > while (chomp()) { > >. . . > > } > > > >should bec

Re: RFC 58 (v1) C changes.

2000-08-07 Thread Bart Lateur
On 7 Aug 2000 16:06:44 -, Perl6 RFC Librarian wrote: >This RFC contains two proposed changes. First, as it is common to want to >removed newlines upon reading a file, > > while (chomp()) { >. . . > } > >should become the equivalent of > > while () { >chomp; >. . . > } ...

RFC 58 (v1) C changes.

2000-08-07 Thread Perl6 RFC Librarian
This and other RFCs are available on the web at http://dev.perl.org/rfc/ =head1 TITLE C changes. =head1 VERSION Maintainer: Ted Ashton <[EMAIL PROTECTED]> Date: 7 Aug 2000 Version: 1 Mailing List: [EMAIL PROTECTED] Number: 58 =head1 ABSTRACT The current return value of C is lit