Fork me on GitHub
#beginners
<
2015-11-13
>
Dosbol04:11:16

Hello, is there anyone?

surreal.analysis14:11:08

What's the reasoning behind using require outside of the ns macro?

alexmiller14:11:07

to cause loading and/or to modify the current namespace's symbol resolution

alexmiller14:11:45

probably mostly done at the repl, but there are some use cases in normal project code too

surreal.analysis14:11:19

Do you have an example when it would be a good use case in normal project code? Having a hard time reasoning about when it would be the right solution.

alexmiller14:11:36

if you have code that dynamically loads a namespace based on configuration

alexmiller14:11:21

https://github.com/clojure/clojure/blob/master/src/clj/clojure/core/server.clj#L63 is an example in the 1.8 socket server that will load the namespace of the provided accept function

meikemertsch15:11:32

There's probably a more idiomatic way to keep constants like file paths, strings for the Ui and such than to def them in a 'constant' namespace, right? Does anyone have input for me there?

swizzard15:11:22

what’s wrong with a constants ns?

swizzard15:11:20

can anyone recommend either a) a good tutorial on java string formatting or b) a library that exposes a better string-formatting api?

surreal.analysis16:11:46

Not really a tutorial, but I found the JavaDocs for Formatter to be pretty comprehensive - https://docs.oracle.com/javase/8/docs/api/java/util/Formatter.html#syntax

surreal.analysis16:11:03

Which is what the built in format function in Clojure uses

surreal.analysis16:11:14

Anything in particular you are trying to do / having trouble with?

swizzard16:11:48

i’ve been thinking about nanogenmo and maybe trying to do some fun string formatting tricks

swizzard16:11:10

but i’m used to python’s string formatting, which seems a lot nicer to me, at least based on my admittedly-scant experience with java's

meikemertsch21:11:46

@swizzard: I don't know. Which other ways are there?

swizzard21:11:43

@meikemertsch: i don’t know! 😞