Hi Marco,

"Marco Maggi" <[EMAIL PROTECTED]> 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.



_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user

Reply via email to