On Nov 15, 12:12 pm, Alyssa Kwan <alyssa.c.k...@gmail.com> wrote:
> In your example, my-generator isn't the concern.  It's the call to my-
> generator that creates functions, each of which creates bytecode, is
> loaded as a class, then is instantiated, and finally invoked.

Not true. Compiling my-generator creates two classes, which at run
time are simply instantiated as needed. Here's an example:

(ns permgen.core
  (:gen-class))

(defn -my-generator []
  (let [x (atom 0)]
    (fn [] (swap! x inc))))

(dotimes [_ 1000]
  (-my-generator))

$ cake compile && ls classes/permgen/*
classes/permgen/core.class
classes/permgen/core__init.class
classes/permgen/core$loading__4410__auto__.class
classes/permgen/core$_my_generator.class
classes/permgen/core$_my_generator$fn__2474.class

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to