On Mon, 20 Apr 2009 21:53:41 +0200
Laurent PETIT laurent.pe...@gmail.com wrote:
Hi David,
2009/4/20 David Nolen dnolen.li...@gmail.com:
A couple of things. In your initial example, you conflated some
things. One issue is simply a matter of convenience- defining a
getter so that you
Timo Mihaljov wrote:
I'm wondering about how to change a data structure without breaking the
API used to access it. For example, let's assume that I have a library
for dealing with records of people and I'm storing them in structs.
(defstruct person :name)
The users of my library
Hi,
2009/4/20 Timo Mihaljov noid@gmail.com
Timo Mihaljov wrote:
I'm wondering about how to change a data structure without breaking the
API used to access it. For example, let's assume that I have a library
for dealing with records of people and I'm storing them in structs.
Laurent PETIT wrote:
While interesting, this approach seems to me limited to simple cases :
* limited in possibilities: you are not able to directly use values of
other fields. So in more complex cases, you won't be able to combine
calculated values without code repetition or prepraration
Hi,
2009/4/20 Timo Mihaljov noid@gmail.com
Laurent PETIT wrote:
While interesting, this approach seems to me limited to simple cases :
* limited in possibilities: you are not able to directly use values of
other fields. So in more complex cases, you won't be able to combine
Laurent PETIT wrote:
What do others think about these 2 above statements ?
The standard OO approach to information hiding would be private fields
and accessor methods. Any suggestions for the One True Clojure Pattern
that addresses the same problem?
I think accessor
Maybe I'm missing something, but what is wrong with Stuart Sierra's
solution? I quite like it, and it would probably be more appealing if
it were encapsulated into a macro.
(def-propholder person)
(def me (person {:name Matt Clark}))
(def-propholder person2
:name
{:getter (fn [record]
On Apr 20, 12:32 pm, Laurent PETIT laurent.pe...@gmail.com wrote:
I think you Timo ask here a very interesting and important question.
It's not just about having encapsulation or not. It's really about designing
the code so that the library internals can evolve without impact on the user
Hi David,
2009/4/20 David Nolen dnolen.li...@gmail.com:
A couple of things. In your initial example, you conflated some things. One
issue is simply a matter of convenience- defining a getter so that you can
use Python object property access (via the dot operator). Personally I don't
like
On Mon, Apr 20, 2009 at 1:27 PM, Bradbev brad.beveri...@gmail.com wrote:
If you promise that
functions will accept and return maps with certain keys, then you must
keep that promise moving forward.
I think you're missing part of the point of the original post. You
don't really want to
On Apr 20, 4:17 pm, Mark Engelberg mark.engelb...@gmail.com wrote:
On Mon, Apr 20, 2009 at 1:27 PM, Bradbev brad.beveri...@gmail.com wrote:
If you promise that
functions will accept and return maps with certain keys, then you must
keep that promise moving forward.
I think you're
On Apr 20, 2:17 pm, Mark Engelberg mark.engelb...@gmail.com wrote:
On Mon, Apr 20, 2009 at 1:27 PM, Bradbev brad.beveri...@gmail.com wrote:
If you promise that
functions will accept and return maps with certain keys, then you must
keep that promise moving forward.
I think you're missing
Hi,
I'm wondering about how to change a data structure without breaking the
API used to access it. For example, let's assume that I have a library
for dealing with records of people and I'm storing them in structs.
(defstruct person :name)
The users of my library access the data stored
On Apr 19, 11:00 am, Timo Mihaljov noid@gmail.com wrote:
I'm wondering about how to change a data structure without breaking the
API used to access it. For example, let's assume that I have a library
for dealing with records of people and I'm storing them in structs.
(defstruct
On Apr 19, 4:00 pm, Timo Mihaljov noid@gmail.com wrote:
What's the idiomatic Clojure way of dealing with this issue?
I'd be tempted to use accessor functions, like:
(defn get-name [person]
(:name person))
When the data structure changes, I update the function:
(defn get-name
15 matches
Mail list logo