On Sun, Jun 10, 2012 at 1:08 PM, Lars Nilsson <chamael...@gmail.com> wrote:
> On Sun, Jun 10, 2012 at 1:04 PM, Jim - FooBar(); <jimpil1...@gmail.com> wrote:
>> Hi again (busy day eh?),
>>
>> well this doesn't make any sense either! Why is a record with  type-hinted
>> arguments still using reflection?
>> I've got the following example record:
>> --------------------------------------------------------------------------------------------------
>> (defrecord CheckersPiece [^java.awt.Color color
>>                                           ^java.awt.Point position
>>                                              rank]
>>  Piece
>>  (update-position [this np] ;mutable state inside Point!
>>   (. position setLocation  ;can accept ints or doubles
>>     (first np) (second np))) ;np should be [x, y]
>>  (die     [this] (vary-meta this assoc :dead true)) ;communicate death
>> through meta-data
>>  (promote [this] (make-checker color position :rank 'prince)) ; a checker is
>> promoted to prince
>>  (getGridPosition [this] (vector (.getX position) (.getY position)))
>>  (getListPosition [this] (translate-position  (first  (.getGridPosition
>> this))
>>                                              (second (.getGridPosition
>> this)) board-mappings-checkers))
>>  (getPoint [this] position)
>>  (getMoves [this] nil) ;TODO
>>  Object
>>  (toString [this]
>>   (println "Checker (" rank ") at position:" (.getListPosition this) " ->"
>> (.getGridPosition this))) )
>> ---------------------------------------------------------------------------------------------------------------------------
>> and whenever i call update-position it complains that setLocation cannot be
>> resolved. setLocation is a method in java.awt.Point so i don't see why this
>> happens!
>
> Would (.setLocation position) possibly behave differently maybe? Worth a try?

Ehh... With the two arguments I forgot to include in the call obviously..

Lars Nilsson

-- 
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