On 28/05/12 11:48, Jim - FooBar(); wrote:
Hello everyone,
I know this is trivial but i just noticed that, unlike proxy, reify
demands that at least the return types are consistent. I had a piece
of code like this:
(defmacro implement-CalculateScore
"Consumer convenience for implementing the CalculateScore interface
which is needed for genetic and simulated annealing training."
[minimize? & body]
`(proxy [CalculateScore] [] ;;no base class
(calculateScore [this ^MLRegression n#] ~@body)
(shouldMinimize [this] ~minimize?)))
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
and in order to use reify instead of proxy i had to type hint the
return types like this:
(defmacro implement-CalculateScore
"Consumer convenience for implementing the CalculateScore interface
which is needed for genetic and simulated annealing training."
[minimize? & body]
`(reify CalculateScore
(^double calculateScore [this ^MLRegression n#] ~@body)
(^boolean shouldMinimize [this] ~minimize?)))
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Is this something you would all expect?If yes can somebody elaborate
as to why that is? Thanks in advance...
Jim
Ooops!!! I know that the proxy version does not need 'this' in the
argument list...bad copy-paste error! I apologise...
Jim
--
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