GNU bug report logs -
#18223
[PATCH] Fix thinko concerning object property docs
Previous Next
Reported by: David Kastrup <dak <at> gnu.org>
Date: Fri, 8 Aug 2014 13:44:01 UTC
Severity: normal
Tags: patch
Merged with 14792
Done: Mark H Weaver <mhw <at> netris.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18223 in the body.
You can then email your comments to 18223 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-guile <at> gnu.org
:
bug#18223
; Package
guile
.
(Fri, 08 Aug 2014 13:44:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
David Kastrup <dak <at> gnu.org>
:
New bug report received and forwarded. Copy sent to
bug-guile <at> gnu.org
.
(Fri, 08 Aug 2014 13:44:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Numeric values cannot reliably be distinguished using eq? and have no
guaranteed object identity.
Signed-off-by: David Kastrup <dak <at> gnu.org>
---
doc/ref/api-utility.texi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/ref/api-utility.texi b/doc/ref/api-utility.texi
index ffdf276..e2b60e2 100644
--- a/doc/ref/api-utility.texi
+++ b/doc/ref/api-utility.texi
@@ -222,7 +222,7 @@ setting of @var{obj}'s @var{property}.
A single object property created by @code{make-object-property} can
associate distinct property values with all Scheme values that are
-distinguishable by @code{eq?} (including, for example, integers).
+distinguishable by @code{eq?} (ruling out numeric values).
Internally, object properties are implemented using a weak key hash
table. This means that, as long as a Scheme value with property values
--
1.9.1
Information forwarded
to
bug-guile <at> gnu.org
:
bug#18223
; Package
guile
.
(Sat, 09 Aug 2014 09:47:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 18223 <at> debbugs.gnu.org (full text, mbox):
This is actually a duplicate of issue 14792 which has been ignored for
over a year by now.
Please see <URL:http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14792#35>
for the reason the provided patch (namely discouraging the use of
numbers for object properties) is the only one making sense.
Here is the rationale in code: object properties are implemented via
key-weak hash tables, and weak hash tables will not work with eqv? as
equivalence since key-weakness is related to garbage collection which
cannot consider anything but eq?-equivalence.
scheme@(guile-user)> (define x (make-weak-key-hash-table))
scheme@(guile-user)> (hashv-set! x 100000000000000000000 #t)
$6 = #t
scheme@(guile-user)> (gc)
scheme@(guile-user)> (hashv-ref x 100000000000000000000)
$7 = #f
Guile and/or Scheme do not store the equivalence relation in the
hashtable itself, and user-definable hash functions may establish
arbitrary relations regarding key uniqueness that have no clear relation
to the object identity used by garbage collection.
--
David Kastrup
Information forwarded
to
bug-guile <at> gnu.org
:
bug#18223
; Package
guile
.
(Sat, 09 Aug 2014 10:21:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 18223 <at> debbugs.gnu.org (full text, mbox):
scheme@(guile-user)> (define wooziness (make-object-property))
scheme@(guile-user)> (set! (wooziness 5) #t)
$1 = #t
scheme@(guile-user)> (wooziness 5)
$2 = #t
scheme@(guile-user)> (set! (wooziness 1000000000000000000) #t)
$3 = #t
scheme@(guile-user)> (wooziness 1000000000000000000)
$4 = #f
scheme@(guile-user)>
The property persists for 5 and evaporates for 1000000000000000000.
There is no reliable way to know whether it will persist for numbers.
And since Guile refuses to commit to guaranteeing (lambda (x) (eq? x x))
to return #t when x may be a number and since there is no guarantee just
which numbers may be represented by immediate values, there is no
context in which an object property on a number may safely be retrieved.
--
David Kastrup
Information forwarded
to
bug-guile <at> gnu.org
:
bug#18223
; Package
guile
.
(Sat, 09 Aug 2014 12:17:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 18223 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
I can't reproduce it, but I'm using the latest mater. Could you provide
your version?
2014年8月9日 下午5:47于 "David Kastrup" <dak <at> gnu.org>写道:
>
> This is actually a duplicate of issue 14792 which has been ignored for
> over a year by now.
>
> Please see <URL:http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14792#35>
> for the reason the provided patch (namely discouraging the use of
> numbers for object properties) is the only one making sense.
>
> Here is the rationale in code: object properties are implemented via
> key-weak hash tables, and weak hash tables will not work with eqv? as
> equivalence since key-weakness is related to garbage collection which
> cannot consider anything but eq?-equivalence.
>
> scheme@(guile-user)> (define x (make-weak-key-hash-table))
> scheme@(guile-user)> (hashv-set! x 100000000000000000000 #t)
> $6 = #t
> scheme@(guile-user)> (gc)
> scheme@(guile-user)> (hashv-ref x 100000000000000000000)
> $7 = #f
>
> Guile and/or Scheme do not store the equivalence relation in the
> hashtable itself, and user-definable hash functions may establish
> arbitrary relations regarding key uniqueness that have no clear relation
> to the object identity used by garbage collection.
>
> --
> David Kastrup
>
>
>
>
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-guile <at> gnu.org
:
bug#18223
; Package
guile
.
(Sat, 09 Aug 2014 12:22:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 18223 <at> debbugs.gnu.org (full text, mbox):
Nala Ginrut <nalaginrut <at> gmail.com> writes:
> I can't reproduce it, but I'm using the latest mater. Could you provide
> your version?
My version is 2.0.9, but more importantly my architecture is 32bit.
Just add enough zeros to move beyond the largest immediate integer, and
you'll likely see the same effect.
--
David Kastrup
Merged 14792 18223.
Request was from
David Kastrup <dak <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Sun, 10 Aug 2014 13:06:01 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-guile <at> gnu.org
:
bug#18223
; Package
guile
.
(Mon, 11 Aug 2014 03:02:03 GMT)
Full text and
rfc822 format available.
Message #22 received at 18223 <at> debbugs.gnu.org (full text, mbox):
merge 18223 14792
close 18223
close 14792
thanks
David Kastrup <dak <at> gnu.org> writes:
> Here is the rationale in code: object properties are implemented via
> key-weak hash tables, and weak hash tables will not work with eqv? as
> equivalence since key-weakness is related to garbage collection which
> cannot consider anything but eq?-equivalence.
>
> scheme@(guile-user)> (define x (make-weak-key-hash-table))
> scheme@(guile-user)> (hashv-set! x 100000000000000000000 #t)
> $6 = #t
> scheme@(guile-user)> (gc)
> scheme@(guile-user)> (hashv-ref x 100000000000000000000)
> $7 = #f
Indeed, you are right. I added a proper commit message to your patch,
and have applied it to the stable-2.0 branch. I'm closing both bugs.
Thanks!
Mark
Merged 14792 18223.
Request was from
Mark H Weaver <mhw <at> netris.org>
to
control <at> debbugs.gnu.org
.
(Mon, 11 Aug 2014 03:02:04 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
18223 <at> debbugs.gnu.org and David Kastrup <dak <at> gnu.org>
Request was from
Mark H Weaver <mhw <at> netris.org>
to
control <at> debbugs.gnu.org
.
(Mon, 11 Aug 2014 03:02:04 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 08 Sep 2014 11:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 10 years and 284 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.