unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Strange code in modules.c
@ 2003-11-21 23:16 Dirk Herrmann
  2003-11-23 18:11 ` Mikael Djurfeldt
  0 siblings, 1 reply; 3+ messages in thread
From: Dirk Herrmann @ 2003-11-21 23:16 UTC (permalink / raw)


Hi Folks,

the following patch fixes a piece of code in modules.c which seems wrong 
to me. I am, however, not quite sure that I am not missing something. If 
there are no complaints I will submit the patch in the next couple of days.

RCS file: /cvsroot/guile/guile/guile-core/libguile/modules.c,v
retrieving revision 1.51
diff -u -r1.51 modules.c
--- libguile/modules.c  12 Sep 2003 15:11:09 -0000      1.51
+++ libguile/modules.c  21 Nov 2003 22:27:29 -0000
@@ -277,8 +277,7 @@
 module_variable (SCM module, SCM sym)
 {
 #define SCM_BOUND_THING_P(b) \
-  (!SCM_FALSEP(b) && \
-   (!SCM_VARIABLEP(b) || !SCM_UNBNDP (SCM_VARIABLE_REF (b))))
+  (SCM_VARIABLEP (b) && !SCM_UNBNDP (SCM_VARIABLE_REF (b)))
 
   /* 1. Check module obarray */
   SCM b = scm_hashq_ref (SCM_MODULE_OBARRAY (module), sym, SCM_UNDEFINED);

Best regards
Dirk



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Strange code in modules.c
  2003-11-21 23:16 Strange code in modules.c Dirk Herrmann
@ 2003-11-23 18:11 ` Mikael Djurfeldt
  2003-11-27 22:36   ` Dirk Herrmann
  0 siblings, 1 reply; 3+ messages in thread
From: Mikael Djurfeldt @ 2003-11-23 18:11 UTC (permalink / raw)
  Cc: djurfeldt, Marius Vollmer, Guile-Devel Mailing List

Dirk Herrmann <dirk@dirk-herrmanns-seiten.de> writes:

> the following patch fixes a piece of code in modules.c which seems
> wrong to me. I am, however, not quite sure that I am not missing
> something. If there are no complaints I will submit the patch in the
> next couple of days.
>
> RCS file: /cvsroot/guile/guile/guile-core/libguile/modules.c,v
> retrieving revision 1.51
> diff -u -r1.51 modules.c
> --- libguile/modules.c  12 Sep 2003 15:11:09 -0000      1.51
> +++ libguile/modules.c  21 Nov 2003 22:27:29 -0000
> @@ -277,8 +277,7 @@
>  module_variable (SCM module, SCM sym)
>  {
>  #define SCM_BOUND_THING_P(b) \
> -  (!SCM_FALSEP(b) && \
> -   (!SCM_VARIABLEP(b) || !SCM_UNBNDP (SCM_VARIABLE_REF (b))))
> +  (SCM_VARIABLEP (b) && !SCM_UNBNDP (SCM_VARIABLE_REF (b)))
>   /* 1. Check module obarray */
>    SCM b = scm_hashq_ref (SCM_MODULE_OBARRAY (module), sym, SCM_UNDEFINED);

It looks like the old code takes care of two kinds of obarrays:

1. Those which bind identifiers to locations represented by hash buckets.

2. Those which bind identifiers to locations represented by variables
   (in a hash bucket).

(The code assumes that variables aren't passed around as values on the
user level, which is probably wrong.)

I think Guile used to have both.  The "system" obarrays (the ones
which were initialized early before booting the module system) was of
the first kind and module system obarrays was of the second kind.

You'd better check that this is no longer the case, and that *all*
bindings use variables.  (That is of course the proper way.)

We should also be aware that the change you suggest introduces a kind
of backward incompatibility with regards to the module system.  I
doubt that many people have relied much on the module system API, though...

Best regards,
Mikael



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Strange code in modules.c
  2003-11-23 18:11 ` Mikael Djurfeldt
@ 2003-11-27 22:36   ` Dirk Herrmann
  0 siblings, 0 replies; 3+ messages in thread
From: Dirk Herrmann @ 2003-11-27 22:36 UTC (permalink / raw)
  Cc: Marius Vollmer, Guile-Devel Mailing List

Mikael Djurfeldt wrote:

>You'd better check that this is no longer the case, and that *all*
>bindings use variables.  (That is of course the proper way.)
>
>We should also be aware that the change you suggest introduces a kind
>of backward incompatibility with regards to the module system.  I
>doubt that many people have relied much on the module system API, though...
>  
>
Thanks for your comment. As far as I see it, the function scm_sym2var 
would throw an error if it ever encountered some non-variable object in 
an obarray (obtained from scm_eval_closure_lookup, which obtains it from 
module_variable, which is the function under discussion). Therefore I 
consider it safe to assume that Guile has for some time only supported 
obarrays holding variables.

Best regards
Dirk Herrmann



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-11-27 22:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-21 23:16 Strange code in modules.c Dirk Herrmann
2003-11-23 18:11 ` Mikael Djurfeldt
2003-11-27 22:36   ` Dirk Herrmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).