[usocket-devel] Portably supporting :external-format

Erik Huelsmann ehuels at gmail.com
Sun Oct 22 22:25:39 UTC 2006


> > So, to stay backward compatible, this is what I'd like to do:
> >
> > - If no external-format is given: just return the raw stream returned
> > by the implementation (as we do now)
> > - If an external-format is specified, create a raw stream with 'octet'
> > element-type and wrap the returned stream with a flexi-stream,
> > exposing the flexi-stream to the caller.
> >
> > How about that?

> Flexi-streams depends on trivial-gray-streams, which appears to
> support the following implementations:
>
>  - Allegro
>  - CMUCL
>  - LispWorks
>  - OpenMCL
>  - CLISP
>  - SBCL
>
> It doesn't appear to support ABCL or Scieneer CL. For that reason, we
> can't simply make it a mandatory dependency, unless we want to give up
> on those implementations. How do you propose we make it optional?

Well, there's another option: I talked to David Lichteblau and he will
accept patches to support more implementations. I already had ABCL
installed on my system, so I've been working to add ABCL support
today.

ABCL users probably won't want to use the facility, because (as the
authors say themselves) "CLOS is dead slow" and Gray streams use
CLOS...

As far as Scieneer is concerned, well given their prices, I won't be
able to afford to have an installation, but maybe Douglas Crosher (who
I CC'ed in with this message) can provide a patch to
trivial-gray-streams too?

> One idea that comes to mind is to only use flexi-streams if it has
> already been loaded when package.lisp is loaded. If it has, we set a
> *use-flexi-streams* variable (or something), and then test that
> whenever we need to deal with :external-format. In addition, we could
> expose this variable to the user, allowing them to test or set it.

Well, I'd like to check and see if it's possible to extend
trivial-gray-streams (and possibly flexi-streams) to support our
use-case.

Looking at ABCL and flexi-streams though, I do see a problem: ABCL
doesn't have a generic function close, but defines STREAM-CLOSE
instead... At least flexi-streams 0.5.10 seems to depend on close,
open-stream-p and maybe others too, to be generic functions, not just
defuns...

Well, ABCL isn't in wide use anyway and not going very fast
development, but, well, I could ask around with the developers what to
expect there. It would indeed be too bad not to be able to support
:external-format there, but that's an option too (just ignore the
external-format in case of ABCL). We need to make sure to document
that though.

bye,

Erik.

PS: Douglas, do you have interface documentation for Scieneer Gray
streams somewhere for me? Or could you have a look at
trivial-gray-streams (and flexi-streams) and tell us if it's possible
to add code for Scieneer to them?



More information about the usocket-devel mailing list