scsh-users
[Top] [All Lists]

Re: suggested features

To: shivers@mintaka.lcs.mit.edu
Subject: Re: suggested features
From: Scott Schwartz <schwartz@galapagos.cse.psu.edu>
Date: Fri, 2 Dec 1994 16:22:34 -0500
Cc: Brent.Benson@mail.csd.harris.com, scsh@martigny.ai.mit.edu
| Thanks for the mail. The regexp-delimited field reader -- I'd like to hear
| more about your thoughts on that.

Regexps are nice because they are a powerful and general purpose
mechanism.  If you have them at all, they should be pervasive and well
integrated.  Perl uses them  to great effect.  Most of the time split
will be called on a literal string (which the compiler notices and
optimizes), but regexps do get used.  Here's one example from the perl
library:

termcap.pl:    foreach $field (split(/:[\s:\\]*/,$TERMCAP)) {

| A field reader consumes the record-delimiting char(s) before returning
| (so there's no way to distinguish a record terminated by eof and one
| terminated by a delimiter).

Perl has a mode wherein it returns both delimited items and their
delimiters.  In a regexp match you sometimes need this to see what
exactly got used as a delimiter.  That mechanism also gives a way to
distinguish the case you mention.


<Prev in Thread] Current Thread [Next in Thread>