This is the mail archive of the
guile@sources.redhat.com
mailing list for the Guile project.
Re: Challenge
From: Chris Cramer <crayc@kiwi.pyro.net>
Subject: Re: Challenge
Date: Wed, 9 Aug 2000 16:53:09 -0500
Message-ID: <20000809165309.A1220@kiwi.pyrotechnics.com>
> On Wed, Aug 09, 2000 at 02:55:12PM +0900, sen_ml@eccosys.com wrote:
...
> > i am confused as to why this should work when not explicitly flushing
> > or closing the port originally didn't. i get the feeling there's
> > something going on here that i do not understand.
>
> Ports will get flushed when they closed, and they are closed when they
> are garbage collected. However, originally there was:
>
> (define template (dump-port (open-input-file (cadr command-line))))
> (define content (dump-port (open-input-file (caddr command-line))))
> (define target (open-output-file (cadddr command-line)))
>
> Global defines such as these are never garbage collected, because they
> are forever accessible. If you just define the filename, or skip
> the define altogether, the port becomes inaccessible after it's used
> and is garbage collected.
aha. thanks a lot for the explanation.
> > btw, i was going through guile-procedures.txt and i came across
> > something named `drain-input'. would that have worked in place of
> > `dump-port'?
>
> IIRC drain-input just tosses the input buffer of a port, so no.
i think i misinterpreted the documentation. thanks for the
clarification.