Fork me on GitHub
#beginners
<
2024-06-22
>
Rawad06:06:33

Hello, any recommendations for clojure static or informative website building frameworks. Something like Gatsby in the js world maybe

Bob B07:06:25

cryogen and staticly are two that I'm aware of... <https://www.clojure-toolbox.com/> also has a few others under the 'static site generation' heading

👍 1
seancorfield15:06:30

I like Cryogen and use it for both my blog (http://corfield.org) and for https://clojure-doc.org

👍 1
vaibhav chaturvedi17:06:36

Isn't this a weird behavior of refresh?

user=> @test/x
0
user=> (test/incx)
1
user=> (defn ff [] @test/x)
#'user/ff
user=> (ff)
1
user=> (refresh)
:reloading (app.test)
:ok
user=> @test/x
0
user=> (ff)
1

dpsutton17:06:55

What is your expectation?

dpsutton17:06:35

Seems like the crux of your confusion is if the function ff reads the current value of x every time or grabs its value once at definition time?

vaibhav chaturvedi17:06:47

yes that is my confusion. but there is more..

user=> (require '[app.test :as test])
nil
user=> @test/x
0
user=> (test/incx)
1
user=> (defn ff2 [] (fn [] @test/x))
#'user/ff2
user=> ((ff2))
1
user=> (test/fresh)
:reloading (app.test)
:ok
user=> @test/x
0
user=> ((ff2))
1

vaibhav chaturvedi17:06:25

and also..

user=> (require '[app.test :as test])
nil
user=> @test/x
0
user=> (test/incx)
1
user=> (defn ff2 [] (fn [] @test/x))
#'user/ff2
user=> (test/fresh)
:reloading (app.test)
:ok
user=> @test/x
0
user=> ((ff2))
0

dpsutton18:06:13

test/x can change over time. How would you expect to define a function that returns the value of test/x at the time of function definition vs a function which gets the current value of test/x each time it is invoked?

vaibhav chaturvedi18:06:51

i expect it to give current value in all these cases but it sticks to og value except for when it is both defined as above and used after refresh

dpsutton18:06:24

That’s not how I’m reading it. Seems like you’re always getting the current value. But in a few cases you redefine the value. And then the last case you never increment it

vaibhav chaturvedi18:06:42

i am on repl i increment, then define the function then use refresh from clojure.tools.namespace.repl

dpsutton18:06:10

And that presumably refreshes the definition of user/x to be 0 again

vaibhav chaturvedi18:06:00

test/x that is, it is in a namespace i required which simply has an atom x, and it's incrementer (incx), and a fresh function which does nothing but call refresh only (apparently it doesn't matter in which namespace refresh is required)

dpsutton18:06:42

Refresh will presumably go through the namespaces and reevaluate everything. Do your atom gets reset back to the original value

hiredman18:06:10

Refresh isn't finding a source file for the user namespace, so that is not being wiped and rebuilt, so it maintains stale references to the old stuff that refresh replaced

vaibhav chaturvedi18:06:12

yes! the atom is getting reset (even though i did defonce)

hiredman18:06:38

Yeah, refresh rebuilds from scratch

hiredman18:06:27

It completely blows away namespaces and reloads from disk, it is not the same thing as require :reload or even load-file

vaibhav chaturvedi18:06:45

what's wierd that in og post the function hangs to the atom of previous require, in second also it does, but in third case where it is invoked only after refresh it gives current value

hiredman18:06:27

Because you required the namespace and then refreshed, the user namespace still has a reference to the only un-refreshed version of the namespace

hiredman18:06:57

So you are still calling the un-refreshed functions etc when you call it from user

hiredman18:06:32

If you completely resolve the function from scratch each time it will not depend on the stale state

vaibhav chaturvedi18:06:36

though that's not the case in third one (second case in replies)

hiredman18:06:00

See resolve and requiring-resolve

adi04:06:34

What does refresh get you, if you (in-ns 'app.test) and call your functions?