Re: RFC 58 (v1) Cchomp() 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 is

Re: RFC 58 (v1) Cchomp() 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) Cchomp() 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/ ) { print; #

RE: RFC 58 (v1) Cchomp() 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

Re: RFC 58 (v1) Cchomp() changes.

2000-08-08 Thread Ted Ashton
Thus it was written in the epistle of Segher Boessenkool, The magic defined($_ = FILE) only happens if FILE 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

Re: RFC 58 (v1) Cchomp() changes.

2000-08-08 Thread Larry Wall
Ted Ashton writes: : Thus it was written in the epistle of Segher Boessenkool, : : The magic defined($_ = FILE) only happens if FILE 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) Cchomp() 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) Cchomp() 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($_ = FILE) only happens if FILE 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) Cchomp() 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 input

Re: RFC 58 (v1) Cchomp() 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, instead

Re: RFC 58 (v1) Cchomp() 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

Re: RFC 58 (v1) Cchomp() 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) Cchomp() 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 haven't set their

RE: RFC 58 (v1) Cchomp() 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) Cchomp() 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 even want to

Re: RFC 58 (v1) Cchomp() 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. Please

Re: RFC 58 (v1) Cchomp() changes.

2000-08-08 Thread Uri Guttman
"MM" == Michael Mathews [EMAIL PROTECTED] writes: What about a chomp($foo, '\r\n'); # or chomp(FH, '\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 chomp should be smarter

Re: RFC 58 (v1) Cchomp() 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

Re: RFC 58 (v1) Cchomp() 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) Cchomp() 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) Cchomp() 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 where found,

Re: RFC 58 (v1) Cchomp() 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 user

Re: RFC 58 (v1) Cchomp() 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. this needs

Re: RFC 58 (v1) Cchomp() 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-argument one

Re: RFC 58 (v1) Cchomp() 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 talking

Re: RFC 58 (v1) Cchomp() 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(FILEHANDLE)) { . . . } should become the equivalent of while (FILEHANDLE) { chomp; . . .

Re: RFC 58 (v1) Cchomp() 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(FILEHANDLE)) { . . . } should become the