Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DFA rules and p5's $/

4 views
Skip to first unread message

Brad Bowman

unread,
Mar 13, 2007, 11:11:32 PM3/13/07
to perl6-l...@perl.org
Hello,

Regarding this from perlvar:

Remember: the value of $/ is a string, not a regex. awk has to
be better for something. :-)

It seems to me that the DFAable rules would intertwingle nicely as
a non-backtracking stream chunker. Is the form of per-filehandle
input record separators in the Synposes yet? I couldn't find it.


Brad

--
If there is something that must be done, it is better not to rely on others.
-- Hagakure http://bereft.net/hagakure/

Larry Wall

unread,
Mar 14, 2007, 12:26:45 AM3/14/07
to perl6-l...@perl.org
On Wed, Mar 14, 2007 at 02:11:32PM +1100, Brad Bowman wrote:
: Hello,

:
: Regarding this from perlvar:
:
: Remember: the value of $/ is a string, not a regex. awk has to
: be better for something. :-)
:
: It seems to me that the DFAable rules would intertwingle nicely as
: a non-backtracking stream chunker. Is the form of per-filehandle
: input record separators in the Synposes yet? I couldn't find it.

No, though it was discussed in ages past. However, I've just added
a remark to Functions.pod that .split may be used on filehandles and
lists just like .comb can, which gives you $*ARGS.split(/\n[\h*\n]+/)
or some such for paragraph mode.

We might yet attach something to an IO object that can do it too,
and maybe it can even make better guarantees about leaving the
file position after the record separator, which split can't really
guarantee under the current definition of laziness (unless we allow
arbitrary pushback onto filehandles). But these days we're in the
mode where specs are being driven primarily by the implementors,
and nobody's working much on the IO layers/roles at the moment.
Feel free to whack on 'em if you like.

Larry

0 new messages