Re: [Scheme-reports] get-output-string on closed ports
John Cowan 07 Feb 2015 13:51 UTC
Alex Shinn scripsit:
> I still don't understand what is meant by leaky, or why
> this closure is any way preferable to a single object.
Because it lessens the amount of ambient authority. In SRFI 6,
I can't give you the authority to extract objects from the output port
without also giving you the authority to write to it.
> > I personally prefer the R6RS API, partly because the question
> > > of get-output-string on non-string ports becomes a non-issue,
> > > and partly because once you introduce custom ports, then
> > > string ports can just be a library function.
> >
> > I don't understand why those don't apply to the R6RS version as well.
>
> I was talking about the R6RS version. Did you
> mean the SRFI 6 version?
Yes.
> The problem with a single global get-output-string
> procedure is that it needs a way to get at the underlying
> buffer associated with the string port, which you can't
> do portably. The best you can do is, assuming you
> have weak references, maintain a global weak hash
> eqv? table mapping string port to buffer.
Custom ports always involve closing over some sort of data structure,
which can be a character sequence as well as anything else.
--
John Cowan http://www.ccil.org/~cowan cowan@ccil.org
"But I am the real Strider, fortunately," he said, looking down at them
with his face softened by a sudden smile. "I am Aragorn son of Arathorn,
and if by life or death I can save you, I will."
_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports