unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* port-filename documentation incorrect
@ 2011-02-07 20:41 Andy Wingo
  2011-02-08 22:16 ` Andy Wingo
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Wingo @ 2011-02-07 20:41 UTC (permalink / raw)
  To: bug-guile

Quoth the docs:

 -- Scheme Procedure: port-filename port
 -- C Function: scm_port_filename (port)
     Return the filename associated with PORT.  This function returns
     the strings "standard input", "standard output" and "standard
     error" when called on the current input, output and error ports
     respectively.

     PORT must be open, `port-filename' cannot be used once the port is
     closed.

But:

  scheme@(guile-user)> (port-filename (current-input-port))
  $1 = #f

And additionally, when connecting to a --listen socket:

  > (port-filename (current-input-port))
  $3 = socket

i.e. a symbol, not a string (!).

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: port-filename documentation incorrect
  2011-02-07 20:41 port-filename documentation incorrect Andy Wingo
@ 2011-02-08 22:16 ` Andy Wingo
  2011-02-28 19:55   ` Andy Wingo
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Wingo @ 2011-02-08 22:16 UTC (permalink / raw)
  To: bug-guile

On Mon 07 Feb 2011 21:41, Andy Wingo <wingo@pobox.com> writes:

> Quoth the docs:
>
>  -- Scheme Procedure: port-filename port
>  -- C Function: scm_port_filename (port)
>      Return the filename associated with PORT.  This function returns
>      the strings "standard input", "standard output" and "standard
>      error" when called on the current input, output and error ports
>      respectively.

I think it does make sense to be able to name a port whatever you want,
but a port-filename should be either a string, indicating a path to a
file, or #f.  I propose to add another field to ports, "name", which
will default to #f.  The accessor `port-name' will use the filename
field if there is no explicit name.  Sockets and other things that want
to name their ports can use the set-port-name! procedure instead of
set-port-filename!.  Non-string names will be deprecated.

What do folks think?

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: port-filename documentation incorrect
  2011-02-08 22:16 ` Andy Wingo
@ 2011-02-28 19:55   ` Andy Wingo
  0 siblings, 0 replies; 3+ messages in thread
From: Andy Wingo @ 2011-02-28 19:55 UTC (permalink / raw)
  To: bug-guile

On Tue 08 Feb 2011 23:16, Andy Wingo <wingo@pobox.com> writes:

> On Mon 07 Feb 2011 21:41, Andy Wingo <wingo@pobox.com> writes:
>
>> Quoth the docs:
>>
>>  -- Scheme Procedure: port-filename port
>>  -- C Function: scm_port_filename (port)
>>      Return the filename associated with PORT.  This function returns
>>      the strings "standard input", "standard output" and "standard
>>      error" when called on the current input, output and error ports
>>      respectively.
>
> I think it does make sense to be able to name a port whatever you want,
> but a port-filename should be either a string, indicating a path to a
> file, or #f.  I propose to add another field to ports, "name", which
> will default to #f.  The accessor `port-name' will use the filename
> field if there is no explicit name.  Sockets and other things that want
> to name their ports can use the set-port-name! procedure instead of
> set-port-filename!.  Non-string names will be deprecated.

I ended up just fixing the docs to match current behavior.  I don't
think this port-name stuff is a bad idea though.

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-02-28 19:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-07 20:41 port-filename documentation incorrect Andy Wingo
2011-02-08 22:16 ` Andy Wingo
2011-02-28 19:55   ` Andy Wingo

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).