> I'm not sure of the details since I don't know much about Java, but that
> sounds about right. I'm working on a date library, and having to use
> functions like earlier? and later? rather than >, <, <=, and >= feels
> awkward.

You are probably thinking of dates as numerical longs rather than
actual "dates".  If you take a step back from how the date is
represented, it is much clearer to say

(earlier? date1 date2)

than

(< date1 date2)

The latter is open to interpretation and would force any good
programmer to look up what less-than does on the dates in order to get
an intuition about what it *actually* means, whereas most everyone
would agree with what the former is intended to mean.  '<' could be
defined as "happened after" and be a *valid* function definition.  If
"earlier?" was defined as "happened after" it would be considered a
bug.

I realize this is just one use case, but overloading operators can
often decrease readability.  That said, it can also be extremely
convenient and make for more flexible libraries, so perhaps the
argument about a fast math library and convenient non-math behavior by
default is the way to go...

Btw, if you are implementing a date library, I would strongly
recommend looking at Joda Time.  You could probably just write some
clojure wrappers for the library and be done with it (of course, that
would require that the Joda Time jar be on the classpath...).

--Eric Tschetter

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