Front page | perl.perl6.internals |
Postings from December 2001
Re: IO filters
Thread Previous
|
Thread Next
From:
Melvin Smith
Date:
December 18, 2001 12:37
Subject:
Re: IO filters
Message ID:
OF7D8715AC.41EB3D9C-ON85256B26.006FA3E4@raleigh.ibm.com
Dan writes:
>*) Filehandles get treated like arrays. Filters (which will be plain
>coderefs) can be push/pop/shift/unshift/spliced onto them.
By coderef I'm assuming you mean something like this Perl pseudo code...
sub filter_dos_newlines {
my $pmc = shift;
my $op = shift;
if( $op >= 0 && $op < MAX_IO_FUN ) {
&{$myfilter_vtable[$op]}( \$pmc->data );
}
return $pmc;
}
>*) Filters get passed a PMC and an int. The int is a function number
>(1=read, 2=write, 3=seek, 4=tell, 5=control, or something like that) and
>the PMC represents the source data. They return a mutated PMC that's
passed
>on to the next filter.
Sounds like layers except with layers layer[i] is chained with layer[i+1]
and calls it directly.
>I'd like the whole filter chain to run in its own interpreter, but that
>means the filters can't ultimately return objects and things like that,
>which is sort of bad.
I'll let you think on that.
-Melvin Smith
IBM :: Atlanta Innovation Center
melvins@us.ibm.com :: 770-835-6984
Thread Previous
|
Thread Next