guile-user
[Top][All Lists]
Advanced

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

Re: the future of Guile


From: Ludovic Courtès
Subject: Re: the future of Guile
Date: Wed, 05 Dec 2007 23:56:36 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

Hi Marco,

"Marco Maggi" <address@hidden> writes:

> Woah! I had not noticed  that the binding is created in (oop
> goops).

He he.  ;-)

> SCM
> my_func (SCM arg)
> {
>    client_data_t data = (client_data_t)SCM_SMOB_DATA(arg);
>
>    /* Do something with "data" but do not access "arg"
>       anymore. With compiler optimisations the reference
>       to the SMOB can disappear.
>
>       If here I call scm_* functions, GC collects the
>       SMOB removing the carpet from under my feet and
>       if I access "data": crash. 
>
>       So:
>    */
>    scm_remember_upto_here_1(arg);
> }

Hmm, right (except if ARG was passed on the stack, which must not be the
case with most ABIs).

OTOH, when `my_func ()' is a subr called by the evaluator, there
definitely are live references to ARG in the heap (argument list) and
probably on the stack too (local variables in `CEVAL ()'), which is why
it rarely hurts in practice...

>>Records are too  common to be removed from  the core: almost
>>everyone would end up loading that module.
>
> This surprises  me. I thought  that they were a  rarely used
> feature because  they are unschemey  :-) and because  of the
> existence of GOOPS.

Well, maybe my statement was too strong.  At least I do use records a
lot.  Any programming language needs vector-like data structures, and
records provide a convenient interface to them in many scenarios.

Thanks,
Ludovic.





reply via email to

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