[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: RFC: stream support on lua zlib binding
- From: Thomas Lauer <thomas.lauer@...>
- Date: Wed, 26 Mar 2008 14:44:09 +0000
"Jerome Vuarand" <firstname.lastname@example.org> wrote:
> Thomas Lauer wrote:
> > Wouldn't it be nice if the io module were layered and accepted,
> > within the functional framework already defined, "drivers" which
> > implement the actual I/O? These pluggable drivers would use the
> > infrastructure of the io module, both internally (ie code in
> > liolib.c) and externally. File access via the C runtime (as already
> > implemented in io) would be included by default but this would just
> > be one of many possible drivers which can use the io framework.
> So far I haven't felt the need to have a 'framework' implemented in io
> library, but next time I add a loader I'll probably refactor that to use
> an array like the one used by require.
When I said "framework" I simply meant the current functions in the io
module. These are currently all hard-coded to use C runtime file io.
What I'd like is to keep that same external calling interface but have
the io functions call pluggable read, write, flush etc. functions
depending on the "filesystem" that was used in the io.open() call used
to open the "file".
As it is right now, I am going to duplicate a lot of functionality for
each further "filesystem" that's implemented.
I once did a prototype of such a module but I never got very far in
really integrating it with the io module in a transparent way.