They are likely to be more useful when using Clojure as a serialisation syntax for data (much like how JSON is used with JavaScript), rather than when used directly in source code.
I assume that these extensible literals will be ported to the JavaScript and .NET implementations of Clojure, making it easier to work with rich data types without having to pepper your code with calls to date parsing functions, etc.
Having an intuitive, idiomatic concept of 'data' at the heart of your code is an important aspect of Clojure.
In comparison, I find it hard to the answer the question, "How is data represented in Java?" Which is why I find doing things like data transformation to be far easier in Clojure than in Java.
I think it was a case of a couple useful examples of the new literals as a pattern for developers.
Re:Clojure 1.4 released
by technomancy on Wednesday April 18, 2012 @12:21PM
(#3858716)
Instant literals returning java.util.Date instances are a great way to sneak bugs into a codebase that uses immutable values everywhere else.
The mutable methods of the Date class all look to be deprecated. No?
Re:Clojure 1.4 released
by technomancy on Wednesday April 18, 2012 @04:26PM
(#3860000)
That doesn't stop them from being called. As soon as you introduce an object like this, you throw a bunch of important guarantees about your code out the window.
True. At least in Clojure you can change the default behaviour.
So I'm hoping for someone more knowledgeable than me chiming in and explaining possible drivers/motivations for these literals. When do you write a literal uuid?