On 10 September 2014 at 21:11:06, j...@afandian.com (j...@afandian.com) wrote:
> I just noticed that the ReadableInstant[0] interface is generic,
> extending Comparable [1]. Is it possible to implement a generic
> interface with a defrecord?
Type parameters in generics do not exist at runtime,
I just noticed that the ReadableInstant[0] interface is generic, extending
Comparable [1]. Is it possible to implement a generic interface with a
defrecord?
[0]
http://joda-time.sourceforge.net/apidocs/org/joda/time/ReadableInstant.html
[1] http://docs.oracle.com/javase/1.5.0/docs/api/java/lang
Thanks. Sorry this is turning into a bit of a brain dump. I've created my
record that decorates the original type:
(defprotocol IWeirdDate
(as-date [this])
(pp [this]))
(defrecord WeirdDate [year month day]
IWeirdDate
(pp [this] (condp = month
21 (str "Spring " year)
On 10 September 2014 at 15:42:01, j...@afandian.com (j...@afandian.com) wrote:
> Is this the right way to do this?
Yes.
> Could I somehow make this implicit
> and avoid re-writing the DateTimeProtocol implementations?
There's no way around implementing the DateTimeProtocol functions you need