Re: top-level lets or private globals

2015-08-27 Thread pmf
On Thursday, August 27, 2015 at 1:15:14 AM UTC+2, red...@gmail.com wrote: > > I have found the access control stuff in Java to be an incredible pain. > When attempting to compose a larger system from the parts. Generally > everything is compulsively private, so if an api doesn't exactly expose >

Re: top-level lets or private globals

2015-08-26 Thread Kurt Sys
I do understand that point of view and largely agree. However, some (pretty small) functions or constants are private to some namespace, or rather, to some scope inside a namespace. I consider the public functions as the 'API of the namespace'. Internals shouldn't be exposed, so I can change i

Re: top-level lets or private globals

2015-08-26 Thread Kurt Sys
Allright, so I'll probably stick to top-level lets... Thx! Op woensdag 26 augustus 2015 18:44:18 UTC+2 schreef Herwig Hochleitner: > > I can't really speak to what's more idiomatic, but there is a slight > difference between a top-level let and ^:const ^:private. > ^:const makes the compiler dire

Re: top-level lets or private globals

2015-08-26 Thread Kevin Downey
On 8/25/15 12:06 AM, Kurt Sys wrote: > I'm refering to a few posts in an old thread: > https://groups.google.com/d/msg/clojure/r_ym-h53f1E/RzUdb5oYeX4J > > What really puzzles me is that it doesn't seem to be generally > regarded as idiomatic Clojure style to just use top-level (let)s for

Re: top-level lets or private globals

2015-08-26 Thread Herwig Hochleitner
I can't really speak to what's more idiomatic, but there is a slight difference between a top-level let and ^:const ^:private. ^:const makes the compiler directly inline the form, thus it works only on pr-dup - able values. This has gotten me by surprise some times. This also duplicates values, tha

Re: top-level lets or private globals

2015-08-25 Thread Kurt Sys
**EDIT: I've put some (private, mostly pretty small) 'helper'-functions outside the let-block. I like this kind of construct in some way. It makes a clear distinction between: 1. functions that don't use the 'namespace constants', mostly helper functions (very often, most of these can be

Re: top-level lets or private globals

2015-08-25 Thread Kurt Sys
Well, honestly, I tend to use pretty big lets in my namespaces. I know I can use (private) namespace-scoped variables (or rather, contstants :) ) , but somehow, I don't really like them. So what I mostly have now: (ns my.namespece (require [other.namespace : as o] [cool.namespace

Re: top-level lets or private globals

2015-08-25 Thread Alan Thompson
*** premature send *** Ya know, I've never seen that before but I like it! I have previously noticed (by accident) that you can have "naked" expressions in a file/namespace (i.e. not inside of a def/defn). For example, I use a statement like this: (ns ... (:require [tupelo.core :refer [spyx]]

Re: top-level lets or private globals

2015-08-25 Thread Alan Thompson
Ya know, I've never seen that before but I like it! I have noticed that you can have "naked" expressions in a file (i.e. not inside of a def/defn). For example, I use a statement like this: (require '[tupelo.core :refer [spyx]]) (spyx *clojure-version*) at the top of my main testing namespace t