guile-user
[Top][All Lists]
Advanced

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

Re: mutating C binding arguments?


From: Michael Livshin
Subject: Re: mutating C binding arguments?
Date: 22 Jan 2001 13:50:46 +0200
User-agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Crater Lake)

<meta-comment>

`values' and `call-with-values' will be C-level primitives in the next
version of Guile (and already are in the CVS version).  thanks Gary!

</meta-comment>

Rob Browning <address@hidden> writes:

> Michael Livshin <address@hidden> writes:
> 
> > global_values_proc = scm_permanent_object(gh_lookup("values"));
> 
> Is there any substantive difference here between that and this:
> 
>   global_values_proc = gh_lookup("values");
>   scm_protect_object(global_values_proc);

no substantive difference, just stylistic: `scm_protect_object' is
reversible.

> Also, another more localized alternative might be to use a static in
> the function where "values" is needed, though that could cause
> threading problems if the app is using multiple threads...
> 
> > doesn't _really_ matter in this case (since `values' sits in the root
> > module and isn't likely to go away) but better style anyway.

[ why did I say that?  beats me... ]

> And if "values" is something that could be redefined, and if the user
> would expect that redefinition to take effect everywhere, then I guess
> looking it up at every call would be the only alternative.  (Figured
> maybe I should point that out for the person asking the original
> question).

right.

paging Godot...

-- 
In many cases, writing a program which depends on supernatural insight
to solve a problem is easier than writing one which doesn't.
                                                        -- Paul Graham




reply via email to

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