Hi jbs,
Not sure why the title of this post is about "size" instead of "protection",
but why don't you just use private functions in Clojure?
(defn- my-little-helper [] "visible only in my namespace" ...)
Note the "-" on the end of defn, which is idiomatic for introducing a private
var. You can also do this with explicit {:private true} metadata on the name.
Cheers,
Stu
> I'm new to Clojure and have a long background in Java. After writing
> Clojure code for a month or so now, I find myself struggling with
> function size. If I have expressions that can be grouped by
> association, then I can re-factor these expression(s) into a
> function. However, the newly re-factored function is then accessible
> outside the (let []) of the function from which I'll access it. This
> seems wrong since my new function is only intended to be accessed from
> it's calling function.
>
> In Java, code separation is encouraged to promote cohesion. Classes
> are intended to be small and single purpose in nature. The class's
> public method(s) are intended to provide the interface (or api) by
> which the functionality of the class is accessed. In Java I can
> constrain access to a method by declaring it private making it
> invisible to calling classes.
>
> For Clojure I'd like to be able to specify the function or set of
> functions that expose the api of a namespace without implying that
> every function in the namespace is meant to be accessed directly.
>
> -jbs
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en