[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sqlite3
From: |
Qiantan Hong |
Subject: |
Re: sqlite3 |
Date: |
Sat, 18 Dec 2021 09:06:22 +0000 |
> It seems no one has yet pointed out "preserving EQness" is actually
> hash-consing[1], a technique has been developed in Lisp and now well
> known in Functional Programming communities.
It is definitely not.
The feature of hash-consing is exactly not preserving EQness,
or, under hash-consing EQ and EQUAL degenerate to the same thing
(Aka, intensional and extensional identity degenerates), effectively
removing the concept of EQ and object identity from the language all
together.
That’s the reason why hash-consing is widely used in purely functional
programs, where programs only cares about extensional identity.
EQness/object identity/intensional identity is significant under mutation,
and actually affects the semantics.
(defun eq (x y)
(let ((probe (gensym))
(save (car x)))
(rplaca x probe)
(prog1
(eq (car y) probe)
(rplaca x save))))
In layman’s term: even if two objects’ value look the same, they may
or may not be the same object. The difference become apparent when
you poke one, and the other may or may not change.
Hash-consing in a mutable language *does not* preserve EQ-ness,
the object identity is arbitrarily merged, and the structure of the reference
graph is not preserved.
- Re: sqlite3, (continued)
- Re: sqlite3, Eli Zaretskii, 2021/12/14
- Re: sqlite3, Lars Ingebrigtsen, 2021/12/14
- Re: sqlite3, Qiantan Hong, 2021/12/14
- Re: sqlite3, Lars Ingebrigtsen, 2021/12/14
- Re: sqlite3, Richard Stallman, 2021/12/16
- Re: sqlite3, Lars Ingebrigtsen, 2021/12/17
- Re: sqlite3, Richard Stallman, 2021/12/17
- Re: sqlite3, Lars Ingebrigtsen, 2021/12/18
- Re: sqlite3, Qiantan Hong, 2021/12/18
- Re: sqlite3, LdBeth, 2021/12/18
- Re: sqlite3,
Qiantan Hong <=
- Re: sqlite3, Tomas Hlavaty, 2021/12/18
- Hash consing (was: Re: sqlite3), Po Lu, 2021/12/18
- Re: sqlite3, LdBeth, 2021/12/18
- Re: Hash consing (was: Re: sqlite3), Philipp, 2021/12/18
- RE: [External] : Re: Hash consing (was: Re: sqlite3), Drew Adams, 2021/12/18
- RE: [External] : Re: Hash consing (was: Re: sqlite3), Tomas Hlavaty, 2021/12/18
- RE: [External] : Re: Hash consing (was: Re: sqlite3), Drew Adams, 2021/12/18
- Re: sqlite3, Richard Stallman, 2021/12/16
- RE: sqlite3, Drew Adams, 2021/12/14
- Re: sqlite3, Qiantan Hong, 2021/12/14