This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: goops/guile doc (was Re: Simple example program to illustrate Goops)
- To: jimb at red-bean dot com
- Subject: Re: goops/guile doc (was Re: Simple example program to illustrate Goops)
- From: Gary Houston <ghouston at arglist dot com>
- Date: 29 Feb 2000 13:51:08 -0000
- CC: guile at sourceware dot cygnus dot com
- References: <20000127120716.29627.qmail@web1805.mail.yahoo.com> <200001280904.JAA00754@ossau> <38918B07.F7DDA4A7@enteract.com> <m3vh3at4d9.fsf@savonarola.red-bean.com>
> From: Jim Blandy <jimb@red-bean.com>
> Date: 27 Feb 2000 22:04:02 -0500
>
> This has more practical consequences, too. For example, folks were
> just talking about binary I/O functions, and it was pointed out that
> it makes sense to apply them not only to streams, but also to strings,
> byte arrays, hypothetical pointer types, and so on.
>
> Well, suppose we defined generic functions `fetch' and `store'. Then
> suppose we define a GOOPS class <representation>, which has elements
> like 16-bit-be-unsigned-int ("be" == "big-endian"), 32-bit-le-signed-int,
> 64-bit-ieee-float, and so on.
Do you mean 16-bit-be-unsigned-int is a class that inherits from
<representation>?
> Then we could define methods like
>
> (fetch <representation> <string>)
>
> to be one set of fast primitives, written in C, and
>
> (fetch <representation> <port>)
>
> to be another set of fast primitives, written in C. Then we just let
> the GOOPS dispatch choose the right function for the particular
> representation and data source.
I'm not convinced. Wouldn't you want an offset argument for the
string/vector version? Otherwise the doesn't seem to be much
advantage in a separate implementations for these cases: it may be
more convenient to wrap the string/byte-vector in a port than to use
substrings or whatever to select the position.
cf. read-char vs string-ref, which is the same thing.