4 ms·
I'm not sure if you're asking about the use of those specific literals or about the extensible reader, but there was a short interview with Rich Hickey about th
by spacemanaki 15y ago
I'm not sure if you're asking about the use of those specific literals or about the extensible reader, but there was a short interview with Rich Hickey about the new extensible reader and there was valuable discussion on HN about it:
http://news.ycombinator.com/item?id=3831803 http://news.ycombinator.com/item?id=3831803
- darklajid 15y agoThanks, but no. I was explicitly referring to the instant literals and uuid literals. I honestly never missed something like that. They seemed esoteric, kind of. 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?
- zephjc 15y agoI think it was a case of a couple useful examples of the new literals as a pattern for developers.
- djpowell 15y agoThey 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.
- technomancy 15y agoInstant literals returning java.util.Date instances are a great way to sneak bugs into a codebase that uses immutable values everywhere else.
- tensor 15y agoThe mutable methods of the Date class all look to be deprecated. No?
- technomancy 15y agoThat 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.
- moomin 15y agoTrue. At least in Clojure you can change the default behaviour.
- deleted 15y ago[deleted]
- moomin 15y agoI think you'll find they're extremely useful for implementing Datomic.