bug#10974: guile-user <at> gnu.org

Ludovic Courtès <ludo <at> gnu.org>
2012-07-02 09:38:27 GMT

Hi,
Sorry for the late reply.
Alexei Matveev <alexei.matveev <at> gmail.com> skribis:
> For use from a Fortran program I am collecting API fixes for libguile.so
> as wrapper functions for what is provided to C-programs as macros.
> I noted that some of the macros are function-macros some are symbol
> macros. An example of the latter is
>
> #define scm_to_int scm_to_int23
The macros in numbers.h that are “symbol macros”, such as
‘scm_from_int’, allow users to write code like:
&scm_from_int
This wouldn’t be possible if these were function macros.
Thus, I think things will have to remain this way.
What do you think?
Thanks,
Ludo’.

bug#10974: guile-user <at> gnu.org

On Mon, Jul 2, 2012 at 11:38 AM, Ludovic Courtès <ludo <at> gnu.org> wrote:
>
>> For use from a Fortran program I am collecting API fixes for libguile.so
>> as wrapper functions for what is provided to C-programs as macros.
>> I noted that some of the macros are function-macros some are symbol
>> macros. An example of the latter is
>>
>> #define scm_to_int scm_to_int23
>
> The macros in numbers.h that are “symbol macros”, such as
> ‘scm_from_int’, allow users to write code like:
>
> &scm_from_int
>
> This wouldn’t be possible if these were function macros.
>
> Thus, I think things will have to remain this way.
Hi,
It's ok. You may close it.
I still think it could be less confusing if the libguile.so implemented/provided
functions as advertised in Guile API docs for the sake of interfacing to
languages other than C. And &scm_from_int wold also work if it were a real
function.
But there are many more macros, so such a link-time interface would be a
lot of work, I realize by now.

bug#10974: guile-user <at> gnu.org

Ludovic Courtès <ludo <at> gnu.org>
2012-07-02 19:17:59 GMT

Hi,
Alexei Matveev <alexei.matveev <at> gmail.com> skribis:
> It's ok. You may close it.
Thanks.
> I still think it could be less confusing if the libguile.so implemented/provided
> functions as advertised in Guile API docs for the sake of interfacing to
> languages other than C. And &scm_from_int wold also work if it were a real
> function.
>
> But there are many more macros, so such a link-time interface would be a
> lot of work, I realize by now.
Yeah. Though here, you could still write bindings for ‘scm_from_int32’
(the real function) instead of ‘scm_from_int’, for instance, no?
Thanks,
Ludo’.

bug#10974: guile-user <at> gnu.org

Andy Wingo <wingo <at> pobox.com>
2012-07-02 21:45:43 GMT

On Mon 02 Jul 2012 11:38, ludo <at> gnu.org (Ludovic Courtès) writes:
> The macros in numbers.h that are “symbol macros”, such as
> ‘scm_from_int’, allow users to write code like:
>
> &scm_from_int
>
> This wouldn’t be possible if these were function macros.
Interesting, I hadn't thought of that.
> Thus, I think things will have to remain this way.
Would this be "fixed" if we changed these to be implemented as inline
functions?
Dunno, just thinking out loud.
Andy
--
--
http://wingolog.org/

bug#10974: guile-user <at> gnu.org

Ludovic Courtès <ludo <at> gnu.org>
2012-07-02 22:35:29 GMT

Hi,
Andy Wingo <wingo <at> pobox.com> skribis:
> Would this be "fixed" if we changed these to be implemented as inline
> functions?
In some way, though their address could still not be taken.
Thanks,
Ludo’.

bug#10974: guile-user <at> gnu.org

Andy Wingo <wingo <at> pobox.com>
2012-07-02 23:17:54 GMT

On Tue 03 Jul 2012 00:35, ludo <at> gnu.org (Ludovic Courtès) writes:
> Andy Wingo <wingo <at> pobox.com> skribis:
>
>> Would this be "fixed" if we changed these to be implemented as inline
>> functions?
>
> In some way, though their address could still not be taken.
Sorry to be obtuse, but with our inline functions, we also residualize a
concrete instantiation (via the inline.c madness). Does that not work?
A
--
--
http://wingolog.org/