Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow various predicates #10

Closed
some-mthfka opened this issue Sep 12, 2018 · 0 comments
Closed

Allow various predicates #10

some-mthfka opened this issue Sep 12, 2018 · 0 comments

Comments

@some-mthfka
Copy link

Hi! I have implemented caching for the google-translate package using pcache. One problem I encountered is, 'equal was needed to use strings as keys, so I changed the pcache-repository class to accept :test and pass it to make-hash-table. It would be nice to see the changes in master.

But before that, there is a bug of a sort:

Create a repo:

(setf repo (pcache-repository "scratch" :test 'equal))
(pcache-put repo "who's" 1337)

After restarting emacs, loading the repo works as expected:

(setf repo (pcache-repository "scratch" :test 'equal))
(pcache-get repo "who's")

--> 1337

however the format in which the repo is saved has aquired the test variable:

;; Object scratch
;; EIEIO PERSISTENT OBJECT
(pcache-repository "scratch"
                   :file "scratch"
                   :object-name "scratch"
                   :version "26.1/0.4"
                   :test equal
                   :entries #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ("who's" (pcache-entry "pcache-entry" :timestamp 1536775676.2360787 :value 1337)))
                   :timestamp 1536775678.6913579)

Running eval-defun on it results in eval: Symbol’s value as variable is void: equal
Changing :test equal to :test 'equal fixes the problem however.

(Once again, all this happens when using eval-defun directly, pcache reloads the cache just fine.)

Do you think this might be a serious bug? Or maybe there is a way to save :test equal as :test 'equal?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant