unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: guile-devel@gnu.org
Subject: Re: review/merge request: wip-array-refactor
Date: Sun, 09 Aug 2009 18:41:43 +0200	[thread overview]
Message-ID: <87bpmpvt14.fsf@gnu.org> (raw)
In-Reply-To: m3k51jdb2j.fsf@pobox.com

Hi Andy!

Andy Wingo <wingo@pobox.com> writes:

> The second model is when you already have a wide deployed base. You can
> make additions to your API and ABI, and deprecated old API or ABI, but
> you can't remove old API or change the ABI. Incompatible breaks are
> painful, and the switching-over time is somewhere between a year and
> three years. The right length of a stable series seems to be about 4 or
> 5 years.

I'm in favor of sticking to this model, i.e., paying attention to both
source and binary compatibility.  That sounds important to me as Guile
is an old piece of software for which users may expect a relative
stability and clear upgrade path when that is needed.

>> (Not sure I agree.  I'd say uniform vectors are mostly holding numbers
>> in a computation, or for plotting on a graph.)
>
> But how do you plot? If you use some sort of external software, you have
> two options: code your plotting in C, and loop overx the data with the C
> API. Or do it in Scheme, and... loop over the s16vector, writing each
> sample individually? How do you get at the bits of the s16vector so they
> can be written to a port? Use the impoverished uniform-vector-write ?

My feeling is that if you plot using, say, GNUplot or Ploticus, you give
them ASCII-formatted numbers, so SRFI-4 is pointless; in other cases, I
suspect the application may use higher-level data types than u8vectors,
which means some conversion is needed anyway when exporting data
bit-wise.

> I've written lots of code that deals with srfi-4 vectors. I have three
> kinds of use cases. First is data being shoved around in a
> dynamically-typed system: dbus messages, gconf values, a system we 
> at work, etc. Second, but related, is dealing with chunks of data that
> come from elsewhere, like GDK pixbufs, or GStreamer buffers. Third is
> hacking compilers, as in Guile itself, or emitting machine code for
> other machines.

My feeling is that the 1st and 3rd use cases are what bytevectors were
written for in the first place.  They allow applications to avoid
reimplementing number serialization as in `write-bytecode' in
`assembly/compile/bytecode.scm'.

SRFI-4 is a good fit for the 2nd use case as you're dealing with
fixed-width native-endianness numbers coming from C code.  But in this
case, I don't think bytevectors are needed at all.

> In summary... I don't mean to be a bore, but I really don't like the
> existing unif.c and srfi-4.c. They are painful to understand and to hack
> on. I think those bits should be merged.

Agreed.

> I also think that srfi-4 vectors should be implemented in terms of
> bytevectors, for the reasons above.

I'm not convinced, but OTOH, I don't think it hurts.

Like Neil, the one thing that I'm not fond of is the switch from
disjoint SRFI-4 types to polymorphic types, because programming errors
that currently yield a `wrong-type-arg' error will be silently ignored.
The SRFI text allows it, but the rationale says that "the use of
homogeneous vectors allows certain errors to be caught earlier."

Thanks,
Ludo'.





  reply	other threads:[~2009-08-09 16:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-19 13:59 review/merge request: wip-array-refactor Andy Wingo
2009-07-22 21:48 ` Neil Jerram
2009-07-28 22:41   ` Andy Wingo
2009-07-30 21:10     ` Neil Jerram
2009-08-04 12:21       ` Andy Wingo
2009-08-09 16:41         ` Ludovic Courtès [this message]
2009-08-12 22:03           ` Andy Wingo
2009-08-13  9:16             ` Ludovic Courtès
2009-07-23 21:08 ` Ludovic Courtès
2009-07-24 22:01   ` Neil Jerram

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=87bpmpvt14.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guile-devel@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).