Moritz Heidkamp committed 4a86e0f

Replace fast-generic with coops

Comments (0)

Files changed (1)


 ;; A (mostly) direct port of ClojureScript's PersistentHashMap implementation
+;; This is a coops based implementation which compared to fast-generic
+;; is slightly smaller in compiled code size but about an order of
+;; magnitude slower at runtime dispatch.
 (module persistent-hash-map
      (only srfi-1 alist-cons)
      (only srfi-69 equal?-hash)
      (only typed-records define-record-type)
-     (rename fast-generic (define-type define-generic-type))
+     (except coops define-class)
 (begin-for-syntax (require-library matchable srfi-1))
                          (list field getter setter (i ':) type))
                        fields getters setters types))
              (define-type ,name (,(i 'struct) ,name))
-             (define-generic-type ,name ,predicate)
+             (define-primitive-class ,name ,predicate)
                 (lambda (field getter)
                   `(define-syntax ,field
              ,@(map (lambda (define-form function args body)
-                      (cons define-form
+                      (cons (if (c 'define-generic define-form)
+                                'define-method
+                                define-form)
                              (cons function
                                    (if (c 'define-generic define-form)
-                                       (cons (list name self) args)
+                                       (cons (list self name) args)
                                        (cons self args)))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.