From: Zelphir Kaltstahl <zelphirkaltstahl@posteo.de>
To: guile-user@gnu.org
Subject: Difference between pipes and ports
Date: Wed, 11 Aug 2021 01:14:13 +0000 [thread overview]
Message-ID: <1c1789ba-68af-66b7-445c-333f02d89392@posteo.de> (raw)
Hello Guile users,
I recently came across
https://www.draketo.de/software/guile-capture-stdout-stderr.html
<https://www.draketo.de/software/guile-capture-stdout-stderr.html> and wrote a
commented version at
https://notabug.org/ZelphirKaltstahl/guile-examples/src/master/input-output/stdout-stderr.scm
<https://notabug.org/ZelphirKaltstahl/guile-examples/src/master/input-output/stdout-stderr.scm>.
While looking at the code, I was starting to wonder, what the difference between
a pipe and a port is. The reference manual does not say much about any
definition of what a pipe is at
https://www.gnu.org/software/guile/manual/html_node/Pipes.html
<https://www.gnu.org/software/guile/manual/html_node/Pipes.html> and pipe
procedure return values are also named port.
However, in the REPL, they look not the same:
~~~~
scheme@(guile-user)> (import (ice-9 popen))
scheme@(guile-user)> (open-input-pipe "ls -al")
$2 = #<input: #{read pipe}# 13>
~~~~
And here for ports:
~~~~
scheme@(guile-user)> (call-with-output-string
(λ (port)
(display port)))
#<output: file 7fa2a99471c0>$6 = ""
~~~~
Is a pipe just a special kind of port? Does it wrap a port? Or is it perhaps
merely a different terminology used in different contexts in the reference manual?
Best regards,
Zelphir
--
repositories: https://notabug.org/ZelphirKaltstahl
next reply other threads:[~2021-08-11 1:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-11 1:14 Zelphir Kaltstahl [this message]
2021-08-11 3:16 ` Difference between pipes and ports Mikael Djurfeldt
2021-08-11 9:48 ` Zelphir Kaltstahl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1c1789ba-68af-66b7-445c-333f02d89392@posteo.de \
--to=zelphirkaltstahl@posteo.de \
--cc=guile-user@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).