From: ludo@gnu.org (Ludovic Courtès)
To: Mark H Weaver <mhw@netris.org>
Cc: guile-devel@gnu.org
Subject: Re: [PATCH] Per-port read options, reader directives, SRFI-105
Date: Fri, 26 Oct 2012 19:30:48 +0200 [thread overview]
Message-ID: <878vat6szb.fsf@gnu.org> (raw)
In-Reply-To: <874nlkx784.fsf@tines.lan> (Mark H. Weaver's message of "Wed, 24 Oct 2012 10:41:47 -0400")
Hi!
Mark H Weaver <mhw@netris.org> skribis:
> ludo@gnu.org (Ludovic Courtès) writes:
>>>> Mark H Weaver <mhw@netris.org> skribis:
>>>>> +set_per_port_read_option (SCM port, int shift, int value)
>>>>
>>>> Also change ‘shift’ to ‘option’, and ‘int value’ to something like
>>>> ‘enum t_option_state value’, where:
>>>>
>>>> enum t_option_state
>>>> {
>>>> OPTION_INHERITED, /* global option setting inherited */
>>>> OPTION_DISABLED,
>>>> OPTION_ENABLED
>>>> };
>>>>
>>>> the goal being to hide as much of the bit-twiddling as possible.
[...]
>> Thus, I thought we’d logically have these 3 functions:
>> set_port_read_options, port_read_options, and applicable_read_options.
>
> Logically, I agree that this would be a nice interface. The problem is
> really one of efficiency. It's quite expensive to access the per-port
> read options directly, because it requires locking the port table mutex,
> doing a hash table lookup, and then an alist lookup. That's not
> something I want to do more than once per call to 'read'. (Even doing
> it once is slightly painful).
Understood.
> Efficiency is the main reason that I chose to compute all of the
> applicable read options and place them in OPTS at the start of 'read'.
> Efficiency is also the reason that I packed all of the read option
> overrides into a single integer.
Yes, that’s fine with me, as long as the visible interface maps as close
as possible to the underlying concepts.
>> Whether these are implemented in terms of bit fields is not the first
>> thing I want to see when I open read.c.
>>
>> Perhaps this is just a matter of presentation, but my impression was
>> that set_port_read_options and the various constants would force me to
>> think in terms of bit-twiddling more than in terms or read options.
>
> FWIW, all of the details of the bit-twiddling and the storage mechanism
> of per-port read options are confined to just two static functions:
> 'init_read_options' and 'set_per_port_read_option'.
>
> The rest of read.c needn't think about bit-twiddling at all. The
> relevant interface for the rest of read.c is as follows:
>
> * Look up applicable read options in OPTS.
> * Set per-port read options by calling 'set_per_port_*'.
OK. I’ll comment on the new version of your patches, thanks!
Ludo’.
next prev parent reply other threads:[~2012-10-26 17:30 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-16 10:32 [PATCH] Per-port read options, reader directives, SRFI-105 Mark H Weaver
2012-10-23 6:06 ` Mark H Weaver
2012-10-23 20:44 ` Ludovic Courtès
2012-10-23 20:45 ` Ludovic Courtès
2012-10-23 20:53 ` Ludovic Courtès
2012-10-23 20:54 ` Ludovic Courtès
2012-10-23 20:57 ` Ludovic Courtès
2012-10-23 20:58 ` Ludovic Courtès
2012-10-23 21:26 ` Ludovic Courtès
2012-10-24 4:04 ` Mark H Weaver
2012-10-24 13:13 ` Ludovic Courtès
2012-10-24 14:41 ` Mark H Weaver
2012-10-26 17:30 ` Ludovic Courtès [this message]
2012-10-23 21:30 ` Ludovic Courtès
2012-10-24 19:00 ` Mark H Weaver
2012-10-24 21:52 ` David A. Wheeler
2012-10-26 17:41 ` Ludovic Courtès
2012-10-26 17:44 ` Ludovic Courtès
2012-10-26 21:21 ` Ludovic Courtès
2012-10-27 1:33 ` Mark H Weaver
2012-10-29 11:14 ` 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=878vat6szb.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=guile-devel@gnu.org \
--cc=mhw@netris.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).