[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Source properties on arbitrary non-immediate values
From: |
Ludovic Courtès |
Subject: |
[PATCH] Source properties on arbitrary non-immediate values |
Date: |
Fri, 07 Oct 2005 14:23:15 +0200 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) |
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 <address@hidden>
* 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);
- [PATCH] Source properties on arbitrary non-immediate values,
Ludovic Courtès <=
- Re: [PATCH] Source properties on arbitrary non-immediate values, Kevin Ryde, 2005/10/07
- Re: [PATCH] Source properties on arbitrary non-immediate values, Neil Jerram, 2005/10/08
- Re: [PATCH] Source properties on arbitrary non-immediate values, Ludovic Courtès, 2005/10/10
- Re: [PATCH] Source properties on arbitrary non-immediate values, Neil Jerram, 2005/10/10
- Re: [PATCH] Source properties on arbitrary non-immediate values, Ludovic Courtès, 2005/10/11
- Re: [PATCH] Source properties on arbitrary non-immediate values, Neil Jerram, 2005/10/11
- Re: [PATCH] Source properties on arbitrary non-immediate values, Ludovic Courtès, 2005/10/12
- Re: [PATCH] Source properties on arbitrary non-immediate values, Neil Jerram, 2005/10/15
- Re: [PATCH] Source properties on arbitrary non-immediate values, Neil Jerram, 2005/10/15
- Re: [PATCH] Source properties on arbitrary non-immediate values, Ludovic Courtès, 2005/10/17