I have a type that's an extended date-time. It can be constructed with the
usual year, month, day parameters but (for legacy reasons) the month can be
overloaded to mean extra things. E.g. a month of 21 means 'spring', 33
means 'third quarter'. I want to construct this type in a way that it
pre
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
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)
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
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,