unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Doug Evans <xdje42@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: port-with-print-state doesn't create a port? Or, when is a port not a port? :-)
Date: Sun, 25 May 2014 12:05:19 -0700	[thread overview]
Message-ID: <CAP9bCMTO=q_ySW8DLvPhJh18oQfS2b_TMGDFx+BpY7V-_VHrkQ@mail.gmail.com> (raw)
In-Reply-To: <87fvk3mcpo.fsf@gnu.org>

On Wed, May 21, 2014 at 7:24 AM, Ludovic Courtès <ludo@gnu.org> wrote:
> Hi!
>
> Doug Evans <xdje42@gmail.com> skribis:
>
>> The problem can be succinctly represented by the following:
>>
>> scheme@(guile-user)> (port? (port-with-print-state (current-output-port)))
>> $3 = #f
>
> I think the short answer is that it’s a very old API that’s essentially
> unused internally.  For instance, make check passes with this patch:
>
>
>
> I think the problem it was trying to solve has been solved differently
> (by explicitly passing the print state in the print.c code, for
> instance), and can easily be solved differently.
>
>> In the meantime, I can make struct printers be aware of the
>> distinction and handle being passed port-with-print-state ports.
>
> Do you actually need this associated state?

Nope.

The point of my message is that if a struct printer written in C
blindly calls scm_puts ... boom.
That, plus it's a bit odd that port-with-print-state doesn't create
something that satisfies port?.

> My first feeling is that we should deprecate and eventually remove this
> API, given that it’s essentially unused and non-functional.
>
> What do people think?
>
>> P.S. How come scm_put[cs]_unlocked are inlined in ports.h?
>
> What’s wrong with that?  (It probably doesn’t help much because
> scm_lfwrite_unlocked isn’t inlined.)

AFAICT there can be no measurable speed up from having them there, so
their presence is at least odd: The astute reader of the file will ask
why they're there, and there is no good answer.



  reply	other threads:[~2014-05-25 19:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-17 18:10 port-with-print-state doesn't create a port? Or, when is a port not a port? :-) Doug Evans
2014-05-21 14:24 ` Ludovic Courtès
2014-05-25 19:05   ` Doug Evans [this message]
2014-05-26 14:47   ` Mark H Weaver
2014-05-26 16:26     ` Ludovic Courtès
2014-06-03 22:57       ` Mark H Weaver
2014-06-04  8:25         ` Ludovic Courtès

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='CAP9bCMTO=q_ySW8DLvPhJh18oQfS2b_TMGDFx+BpY7V-_VHrkQ@mail.gmail.com' \
    --to=xdje42@gmail.com \
    --cc=guile-devel@gnu.org \
    --cc=ludo@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).