>>>>> "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 discipline finds line terminators is
  LW> destined to be a partial solution.  If chomp exists in Perl 6 at
  LW> all, I think it would have to be some kind of method call on the
  LW> string that figures out what the discipline determined to be the
  LW> terminator *for the current line*.  (Note that under Unicode, we
  LW> might well have one line terminated with a line separator, and the
  LW> next line terminated with a page separator, and the line after
  LW> that terminated with a CFLF.)

a couple of ideas. one, i proposed we keep a global $/ and $\ for
default use by handles which haven't set their own. two, instead of
tying the chomp the string and the stream it cam from (boy would that be
easy to break), how about tying it to the handle itself?

        $fh = open( );

        $fh->IRS( "\r\n" ) ;

        $fh->chomp( $foo ) ;

now whether chomp works on the var or returns the chomped string is
still an issue. since this chomp is an method, how about if we pass it a
reference to the var, it works on the var. else it works on the string
and returns it.

  LW> On the other end, we're constrained to be able to translate current
  LW> uses of chop and chomp to something that will work in Perl 6, so we
  LW> can't just throw them out and say the input disciplines will do it all.
  LW> Even if chop and chomp are not longer the preferred way of doing it,
  LW> we'll still have to emulate the functionality somehow.

the handle object approach can support the old way easily. a naked chomp
would assume the $/ from STDIN or the global default $/. the ref
vs. value fixes the do i return a chomped string or the count of chomped
letters.

uri

-- 
Uri Guttman  ---------  [EMAIL PROTECTED]  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com

Reply via email to