Hello, Does anyone know the rationale for allowing to attach source properties _only_ to pairs?
Since I couldn't think of any compelling reason, I tried to remove this limitation, and still I can't see any problem. :-) The patch below allows to do things like this: guile> (define x 'a-symbol) guile> (set-source-properties! x '((a . 2))) ((a . 2)) guile> (source-properties x) ((a . 2)) guile> (define s "a string") guile> (set-source-properties! s '((line . 12))) ((line . 12)) guile> (source-property s 'line) 12 Thanks, Ludovic. 2005-10-07 Ludovic Courtès <[EMAIL PROTECTED]> * srcprop.c (source-properties): Accept non-pair objects. (set-source-properties!): Likewise. (source-property): Likewise. (set-source-property!): Likewise. --- orig/libguile/srcprop.c +++ mod/libguile/srcprop.c @@ -157,8 +157,7 @@ SCM_VALIDATE_NIM (1, obj); if (SCM_MEMOIZEDP (obj)) obj = SCM_MEMOIZED_EXP (obj); - else if (!scm_is_pair (obj)) - SCM_WRONG_TYPE_ARG (1, obj); + p = scm_hashq_ref (scm_source_whash, obj, SCM_EOL); if (SRCPROPSP (p)) return scm_srcprops_to_plist (p); @@ -180,8 +179,7 @@ SCM_VALIDATE_NIM (1, obj); if (SCM_MEMOIZEDP (obj)) obj = SCM_MEMOIZED_EXP (obj); - else if (!scm_is_pair (obj)) - SCM_WRONG_TYPE_ARG(1, obj); + handle = scm_hashq_create_handle_x (scm_source_whash, obj, plist); SCM_SETCDR (handle, plist); return plist; @@ -198,8 +196,7 @@ SCM_VALIDATE_NIM (1, obj); if (SCM_MEMOIZEDP (obj)) obj = SCM_MEMOIZED_EXP (obj); - else if (!scm_is_pair (obj)) - SCM_WRONG_TYPE_ARG (1, obj); + p = scm_hashq_ref (scm_source_whash, obj, SCM_EOL); if (!SRCPROPSP (p)) goto plist; @@ -230,8 +227,7 @@ SCM_VALIDATE_NIM (1, obj); if (SCM_MEMOIZEDP (obj)) obj = SCM_MEMOIZED_EXP (obj); - else if (!scm_is_pair (obj)) - SCM_WRONG_TYPE_ARG (1, obj); + h = scm_whash_get_handle (scm_source_whash, obj); if (SCM_WHASHFOUNDP (h)) p = SCM_WHASHREF (scm_source_whash, h); _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel