This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns clara.rules.durability.print-method | |
(:require [clara.rules.durability :as d] | |
[clara.rules.memory :as mem] | |
[clara.rules.engine :as eng] | |
[clara.rules.compiler :as com] | |
[clojure.java.io :as jio] | |
[clojure.main :as cm]) | |
(:import [clara.rules.durability | |
MemIdx] | |
[clara.rules.memory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defrecord MyTest [a b c d e f g h i j]) | |
;= user.MyTest | |
(time (dotimes [_ 10000000] | |
(new MyTest 1 2 3 4 5 6 7 8 9 10))) | |
;= "Elapsed time: 11.227 msecs" | |
;= nil | |
(time (dotimes [_ 10000000] | |
(->MyTest 1 2 3 4 5 6 7 8 9 10))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package example.drools; | |
public class Utils { | |
public static Boolean useless(final Object... os) { | |
System.out.println("here"); | |
return true; | |
} | |
public static Boolean useless1(final Object... os) { | |
System.out.println("here"); | |
return true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package drools | |
import java.util.Collection; | |
import java.util.List; | |
import java.util.Set; | |
import java.util.HashSet; | |
import java.util.ArrayList; | |
import example.drools.*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; case 1 | |
(defn get-map-of-fn [x] (fn [] x)) | |
;= #'user/get-map-of-fn | |
(defmacro map-of-fn [arg] (get-map-of-fn arg )) | |
;= #'user/map-of-fn | |
(map-of-fn 1) | |
;= #<user$get_map_of_fn$fn__9648 user$get_map_of_fn$fn__9648@47020d4> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I have some Clojure clj files in a jar called A.jar. | |
This jar is started up, and I see that all of the clj files are loaded by the Application ClassLoader, along with the rest of the classes in the jar. | |
At runtime a new jar is added to the classpath, with some clj files that `require`s some of the clj files already loaded by the App ClassLoader. | |
What I have observed is that, when this newly added jar's clj files are being loaded, the `require`s they have on already loaded clj classes, are causing them to be reloaded. | |
The issue is that if these files that are reloaded, have something like `defrecord` in them, they load a new "version" of the same class, with a different classloader. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user> (defrecord MyRec [x]) | |
user.MyRec | |
user> (def m (->MyRec 5)) | |
#'user/m | |
user> (instance? MyRec m) | |
true | |
user> (eval (defrecord MyRec [x])) | |
user.MyRec | |
user> (def m2 (->MyRec 5)) | |
#'user/m2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(setq mac-option-modifier 'control) | |
(setq mac-command-modifier 'meta) | |
;; fix the PATH variable | |
(defun set-exec-path-from-shell-PATH () | |
(let ((path-from-shell (shell-command-to-string "$SHELL -i -c 'echo $PATH'"))) | |
(setenv "PATH" path-from-shell) | |
(setq exec-path (split-string path-from-shell path-separator)))) | |
(when window-system (set-exec-path-from-shell-PATH)) |
NewerOlder