Hi,
maybe you just want a factory?
(defrecord Foo [a b])
(defn make-Foo
[a b]
(Foo. a b))
(defn make
[^String class args]
(let [last-dot (.lastIndexOf class \.)
factory (ns-resolve (symbol (subs class 0 last-dot)) (symbol (str
make- (subs class (inc last-dot)]
(when
Given:
test=(defrecord Foo [A B])
test=(class (Foo. 1 2))
test.Foo
How do I:
test=(new test.Foo 1 2)
#:test.Foo{:A 1, :B 2}
Currently I get Unable to resolve classname: test/Foo.
Thanks,
Timothy
--
“One of the main causes of the fall of the Roman Empire was
that–lacking zero–they had no
Given:
test=(defrecord Foo [A B])
test=(class (Foo. 1 2))
test.Foo
How do I:
test=(new test.Foo 1 2)
#:test.Foo{:A 1, :B 2}
Currently I get Unable to resolve classname: test/Foo.
Thanks,
Timothy
(Class/forName java.lang.String)
Be mindful of the performance...
Stu
Given:
test=(defrecord Foo [A B])
test=(class (Foo. 1 2))
test.Foo
How do I:
test=(new test.Foo 1 2)
#:test.Foo{:A 1, :B 2}
Currently I get Unable to resolve classname: test/Foo.
Check out
(Class/forName java.lang.String)
Oh, does that work in 1.3? Because (new (Class/forName user.Foo))
was the first thing I tried (under 1.2) and it doesn't work. Perhaps
unsurprisingly given that new is a special form.
--
You received this message because you are subscribed to the Google
Groups
On Aug 23, 3:39 pm, Craig Andera cand...@wangdera.com wrote:
(Class/forName java.lang.String)
Oh, does that work in 1.3? Because (new (Class/forName user.Foo))
was the first thing I tried (under 1.2) and it doesn't work. Perhaps
unsurprisingly given that new is a special form.
No. But you
test= (def foo-class-symbol (load-string test.Foo))
test= (def foo (eval (list 'new foo-class-symbol 1 2)))
test= foo
#:test.Foo{:A 1, :B 2}
Is that what you want?
On Aug 23, 6:24 pm, Timothy Baldridge tbaldri...@gmail.com wrote:
Given:
test=(defrecord Foo [A B])
test=(class (Foo. 1 2))