unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Andy Wingo <wingo@pobox.com>
Cc: guile-devel@gnu.org
Subject: Re: How can I tell guile to shut up? ;)
Date: Fri, 01 Jul 2011 15:04:37 +0200	[thread overview]
Message-ID: <87tyb65eze.fsf@gnu.org> (raw)
In-Reply-To: <87zkky8lgi.fsf@pobox.com> (Andy Wingo's message of "Fri, 01 Jul 2011 10:16:29 +0200")

Hello!

Andy Wingo <wingo@pobox.com> skribis:

> Third time's the charm, as they say... here's the deal.  `with-fluids'
> is fairly efficient, because its body does not need to be allocated as a
> closure, but it doesn't provide you any guarantees about the values
> bound to the fluids.  Parameter objects are better in that way, because
> their converter can check the values.  Parameterize is just as short as
> with-fluids, but preserves this correctness property, so it's a good
> thing.

Yes, agreed.  I prefer parameters too, but I was concerned that using
parameters in Guile’s API would introduce an inconsistency, break the
rule of least surprise, etc.

> However parameterize was not as efficient as `with-fluids', because its
> body must be a closure.  This version fixes that, so perhaps parameters
> are the thing now.

OK, understood.

>> How about exposing the fluids the underlie ‘current-input-port’ &
>> co. instead?  This would allow the use of ‘with-fluids’ instead of
>> fiddling with ‘dynamic-wind’ and the like, while being consistent with
>> the rest of Guile.
>
> Would you like users to be able to (fluid-set! %current-input-port
> 'not-a-port)?  Or to (with-fluids ((%current-input-port 'foo)) ...) ?
> Probably not.

No, but OTOH, I *think* it would lead to a graceful type error sooner or
later, as opposed to a crash.

> I think that we should be switching to parameters for user-facing
> dynamic bindings.  Fluids are to dynamic bindings what variables are
> to toplevel bindings: useful building blocks, but not usually what you
> want to give to the user.

Yes, agreed in principle—though in practice variables can be set
arbitrarily.

The problem I have is that (1) I don’t see how we could migrate the
existing public fluids to parameters without breaking the API, and (2)
it’s unpleasant to my eye to have both fluids and parameters in the core
API.

WDYT?

Thanks,
Ludo’.



  reply	other threads:[~2011-07-01 13:04 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <99db88be1896528082d33a77ec4cadbe.squirrel@webmail.kapsi.fi>
2011-03-31 11:11 ` How can I tell guile to shut up? ;) Andy Wingo
2011-06-28 21:52   ` Andy Wingo
2011-06-30  1:24     ` Andreas Rottmann
2011-06-30  9:23       ` Andy Wingo
2011-06-30 21:27         ` Ludovic Courtès
2011-07-01  8:16           ` Andy Wingo
2011-07-01 13:04             ` Ludovic Courtès [this message]
2011-07-01 14:26               ` Andy Wingo
2011-07-04 13:24                 ` Ludovic Courtès
2011-07-18 21:57                 ` Fluids vs parameters: which API is better? Mark H Weaver
2011-07-19  8:19                   ` Andy Wingo
2011-07-24 14:52                     ` BT Templeton
2011-07-25  9:24                       ` Ludovic Courtès
2011-07-25 14:21                         ` Andy Wingo
2011-12-05 17:15       ` How can I tell guile to shut up? ;) Andy Wingo
2011-06-30 21:37     ` Ludovic Courtès
2011-07-01  8:03       ` Andy Wingo
2011-07-01 12:49         ` Ludovic Courtès
     [not found] <502390579.3690191.1452334008441.JavaMail.yahoo.ref@mail.yahoo.com>
2016-01-09 10:06 ` Tobias Reithmaier

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=87tyb65eze.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guile-devel@gnu.org \
    --cc=wingo@pobox.com \
    /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).