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
{:paths ["."] | |
:deps {injure {:mvn/version "1"}}} |
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
{:paths ["."] | |
:deps {missionary {:mvn/version "a.3"}}} |
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 asyncawait | |
(:refer-clojure :exclude [await]) | |
(:require [cloroutine.core :refer [cr]])) | |
(defmacro async [& body] | |
`(js/Promise. (fn [s# f#] | |
(spawn (cr {await thunk} | |
(try (s# (do ~@body)) | |
(catch :default e# (f# e#)))))))) |
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
(import (clojure.asm Type ClassWriter Opcodes) | |
(clojure.asm.commons Method GeneratorAdapter) | |
(clojure.lang DynamicClassLoader Compiler$HostExpr)) | |
(require '[clojure.string :as s]) | |
(defn- struct-bytecode [cname slots] | |
(let [objtype (Type/getType ^Class Object) | |
cv (new ClassWriter (. ClassWriter COMPUTE_MAXS))] | |
(. cv (visit (. Opcodes V1_5) (+ (. Opcodes ACC_PUBLIC) (. Opcodes ACC_FINAL)) |
NewerOlder