> We already have them. They are just functions. > (And I think thinking in term of "factory" functions does not make sense. > Every pure function takes something and makes something out of it) > > The construction of data from data is best taken care by functions. > That way you don't expose more than you want and you are fully flexible. > > If you want to have constructors for your records, define a function: > > (defrecord R ....) > > (defn make-R ([] ...) ([x y] ...)) > > What advantages have your proposal over that? >
You missed my point. I am not against using factory function when needed, I am not saying you cannot do multil-level factory functions. What I am saying is: If you say constructor is bad because it is not flexible, where "bad" means we should not do it at all, then what makes you think one-level factory function "good"? Isn't two-level factory function even more flexible? Then isn't three-level factory even more flexible? So we should *always* use N-level factory functions until we run out stack because that gives us the maximum flexibility? I am challenging this line of logic. I hope the point is clearer now. I list the benefits of constructors before, and I will list them again in my next reply to Luc's post. -- 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 Note that posts from new members are moderated - please be patient with your first post. 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