[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: :export vs. define-public

From: Rob Browning
Subject: Re: :export vs. define-public
Date: Thu, 05 Sep 2002 12:38:03 -0500
User-agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2 (i386-pc-linux-gnu)

Eric E Moore <address@hidden> writes:

> :export makes it considerably easier to port scheme code across
> multiple implememntations, since the code to deal with the module
> systems, which are regrettably non-standard, can be kept separate from
> the R5RS code.  If scheme had an official module system, it might not
> need :export.  'till guile has a good compiler, I'd like to see it
> possible to port code easily.  (I suppose one could write a
> define-public macro for schemes that lack one, but it's still nice to
> have :export)

Actually, I tend to like (export foo) better, but either way I agree,
:export and (export foo) make it possible to have a common source file
that you share between different scheme implementations.  The module
system specific bits can go in a stub file that loads the shared file,
or the sys-specific and shared files can be stuck together via cat at
build time.  While this isn't particularly important for me at the
moment, it has been handy in the past.

Another argument in favor of :export, and (export foo), depending on
how you use them, is that they can be used to centralize the
information about a given module's public exports.  That's something
I've found helpful in the past, but I'm sure which type of locality
you prefer depends on the person.

Personally, I have no problem with the availability of three different
export methods: (export foo), :export, and define-public, though I
actually prefer both (export foo) and :export over define-public since
they keep the module system bits independent of function definition,
and since I also prefer module "signature locality" to "locality of
editing" in this case.

FWIW I tend to use a set of (export foo) declarations at the top of
the file most of the time these days.  I believe (export foo) also
made code generation in g-wrap a little easier since I didn't have to
worry about placement as much, but that's not a big deal either.

Rob Browning
rlb,, and
GPG=1C58 8B2C FB5E 3F64 EA5C  64AE 78FE E5FE F0CB A0AD

reply via email to

[Prev in Thread] Current Thread [Next in Thread]