Fork me on GitHub

When using tools build like so clj -T:build build-fn . How do I include extra aliases? I expected it to be like clj -A:backend -T:build build-fn or clj -T:backend:build build-fn but these appear to be incorrect.


@grounded_sage Perhaps you intend to make a basis with :aliases [:backend] instead? Or do you intend to use code from the backend for the build, rather than making a jar/uberjar/etc from the backend code?


Oh basis looks like it might be what I am looking for.


I recommend going through the tutorial on


Although I now see that :aliases isn't explicitly mentioned there


Yea.. I frequently consult the docs and I was looking at other repos to see if there was anything that appeared to do what I want.


Also I usually skim a lot as well so sometimes I miss things


Basis did the trick. Thanks!

👍 1
Alex Miller (Clojure team)12:05:05

Are you including the alias to change the deps available for the build tooling or for the basis used in the build? If the latter, in your build script when calling b/create-basis, you can pass :aliases […]

Alex Miller (Clojure team)12:05:18

If the former, you should be able to pass it with the -T like you have at the beginning


Is *ns* only meaningful inside a repl?


It’s useful whenever you need the current namespace, repl or not. One caveat, however, is that it cannot be used directly (at runtime) in cljs like it can in clj


In clj, what’s the meaning of current namespace when the function is invoked NOT in a repl?


Quite a philosophical question you’re asking 😂 I don’t know how to answer that question specifically! Have you ever defined a namespaced keyword like so ::my-keyword? If so, then you’ve used the current namespace -albeit at compile time. Surely, it’s not inconceivable that there could be other [perhaps similar] scenarios where the current namespace (at runtime) would have meaning?


I find the *ns* a bit confusing outside of the context of a repl.


I’m trying to reify java.beans.PropertyChangeListener which has a single method propertyChange [_ ^java.beans.PropertyChangeEvent evt] which returns void. But Clojure of course always returns a value so I’m getting the error > Mismatched return type: propertyChange, expected: void, had: java.lang.Object I’m not sure how to wrap this so it returns nothing. Does anyone know how to accomplish this?


I see > If the method has a void return type, the value of the expression will be nil. from the interop reference but i am returning nil

connection=> (-> (data-source)
                   (reify java.beans.PropertyChangeListener
                     (propertyChange ^void [_ ^java.beans.PropertyChangeEvent evt]
                       (tap> {:prop-name (.getPropertyName evt)
                              :old-value (.getOldValue evt)
                              :new-value (.getNewValue evt)
                              :str (str evt)})
Syntax error (IllegalArgumentException) compiling reify* at (REPL:41:20).
Mismatched return type: propertyChange, expected: void, had: java.lang.Object


i had tried to typehint the arg vector but seems it has to go on the method name

(^void propertyChange [_ ^java.beans.PropertyChangeEvent evt]


Clojure 1.10.3
user=> (reify java.beans.PropertyChangeListener
  (propertyChange [_ evt]
    (println "foo")))

#object[user$eval136$reify__137 0x726a6b94 "user$eval136$reify__137@726a6b94"]
user=> user=> (reify java.beans.PropertyChangeListener
  (propertyChange [_ ^java.beans.PropertyChangeEvent evt]
    (println "foo")))
Syntax error (IllegalArgumentException) compiling reify* at (REPL:1:1).
Mismatched return type: propertyChange, expected: void, had: java.lang.Object


oh interesting. since i type hinted i gave conflicting information? And the compiler could figure out the unambiguous types if i hadn’t attempted to help?

Alex Miller (Clojure team)17:05:18

You shouldn't need to do anything for this to work


i see. once again learning rely on the reflection warning and don’t guess


thanks to yall


Does anyone have any experience with hashicorp consul/nomad? I'm looking for something like a luminus template deploy example, where a simple clj app has to connect to a postgres db.


is there a good way to loop over some socket repls from the command line?

echo "(+ 1 1)" | nc localhost 6000
this works but leaves the repl connected. I’m hoping to just capture the output and continue looping but I’m not quite sure how to send an end of input I guess?


using -d it seems this is sending en EOF > (debug) EOF Received from stdin! (removing from lookups..)


-W or -w? And -q should make it exit after EOF


-W and`-q` gives invalid option (this is on an m1 mac). -w gives an invalid wait-time: localhost error


-w takes a timeout value, bit of a hack but idk mac


i gave it a 1 and it seemed to have no change in behavior


echo :repl/quit perhaps?


the version of netcat I have installed (ncat from nmap) works like what you want without doing anything extra


% echo '(+ 1 2)' | nc localhost 9457
user=> 3
user=> %


:repl/quit works. thanks @U04V70XH6. i should have thought about that. I’m confused why this is weird on mac. i’m assuming you are on some linux hiredman?


it is weird on a mac because apple never updates the base utils


so who knows how old the version of netcat they ship is


if you look online you can find people complaining about it, and suggesting installing nmap from homebrew to get ncat


(but yeah, I am on linux)