On Sun, Feb 17, 2013 at 6:12 AM, Jacob Goodson
wrote:
> You need to know something... it's a dialect of LISP, *the only*limitation is
> you.
though it is certainly exerting its limitations on me
>
>
> On Thursday, February 14, 2013 5:08:57 PM UTC-5, AtKaaZ wrote:
>
>> Thank you! I didn't know
You need to know something... it's a dialect of LISP, the only limitation
is you.
On Thursday, February 14, 2013 5:08:57 PM UTC-5, AtKaaZ wrote:
>
> Thank you! I didn't know you could do .newInstance
>
> oh that's a nice trick with eval and list 'new
>
> So it's not impossible after all, thanks A
Thank you! I didn't know you could do .newInstance
oh that's a nice trick with eval and list 'new
So it's not impossible after all, thanks Aaron!
Here's what I got from what you said:
=> *(defmacro mew [cls & restt]
`(eval (list 'new ~cls ~@restt))
)*
#'runtime.q/mew
=> *(let [a java.
Yes, since this is runtime you should use reflection.
(let [a java.lang.RuntimeException]
(.newInstance a))
Alternatively, you can use eval:
(let [a java.lang.RuntimeException]
(eval (list 'new a)))
On Thu, Feb 14, 2013 at 4:53 PM, AtKaaZ wrote:
> I figure since new is expecting a class
and I forgot to mention that I already had another "a" defined
=> a
java.lang.RuntimeException
hence why it worked
On Thu, Feb 14, 2013 at 11:01 PM, AtKaaZ wrote:
> ah I tricked myself... I used "~a" inside the macro instead of "~c" or
> "~cls"
> so back to still impossible
>
> => (defmacro m
ah I tricked myself... I used "~a" inside the macro instead of "~c" or
"~cls"
so back to still impossible
=> (defmacro mew [cls & restt]
(let [c cls]
`(eval (new ~c ~@restt))
)
)
#'runtime.q/mew
=> (let [a java.lang.RuntimeException]
(mew a)
)
CompilerException j
ok looks like it's not impossible:
=> *(defmacro mew [cls & restt]
(let [c a]
`(eval (new ~a ~@restt))
)
)*
#'runtime.q/mew
=> *(let [a java.lang.RuntimeException]
(mew a)
)*
#
On Thu, Feb 14, 2013 at 10:53 PM, AtKaaZ wrote:
> I figure since new is expecting a
I figure since new is expecting a class at compiletime, we can never pass
it a class that we evaluate at runtime(those locals), ergo => impossible to
macro around "new" like that
like this => impossible:
*(let [a java.lang.RuntimeException]
(macro-that-eventually-calls-new a))*
maybe som
thanks for the reply,
=> *(defmacro mew [cls & args]
`(new ~cls ~@args))*
#'runtime.q/mew
=>* (let [a java.lang.RuntimeException]
(mew a)
)*
CompilerException java.lang.IllegalArgumentException: Unable to resolve
classname: a, compiling:(NO_SOURCE_PATH:2:3)
that would be the equiva
On Feb 14, 2013, at 1:27 PM, AtKaaZ wrote:
> The goal is to can write this form:
> => (let [a java.lang.RuntimeException]
> (new a)
> )
> CompilerException java.lang.IllegalArgumentException: Unable to resolve
> classname: a, compiling:(NO_SOURCE_PATH:2:3)
>
> attempt with macro:
> =
The goal is to can write this form:
=> *(let [a java.lang.RuntimeException]
(new a)
)*
CompilerException java.lang.IllegalArgumentException: Unable to resolve
classname: a, compiling:(NO_SOURCE_PATH:2:3)
attempt with macro:
=>* (defmacro mew [cls & restt]
`(new ~(eval cls) ~@restt)
11 matches
Mail list logo