Fork me on GitHub
#tools-deps
<
2018-09-10
>
aitem12:09:47

Hi to all. How i can omit source and obfuscate my target .jar file using deps.edn and clojure cli? Previously i used leiningen and proguard and all works fine. But in current project we are use clojure cli and juxt/pack.alpha for building .jar.

rickmoynihan13:09:45

(read-string "#!/usr/bin/env bash") blows up… but clojure seems to be ok with it… This is the only bit I don’t understand, presumably the clj/`clojure` tools strip this out?

dominicm13:09:21

@rickmoynihan they do not, this is in clojure.core

dominicm13:09:52

! is technically a tagged literal which comments out the whole line

rickmoynihan13:09:12

that was my first thought… but why does read-string blow up?

rickmoynihan13:09:45

ahhh hold on maybe it’s because there’s no more input…

rickmoynihan13:09:58

yeah that’s it

rickmoynihan13:09:21

(read-string "#!/usr/bin/env bash\n 10") works (read-string "#!/usr/bin/env bash") fails

dominicm13:09:23

boring answer 😉 Why is it always a boring answer

dominicm13:09:33

(Because physics isn't broken)

😁 4
rickmoynihan13:09:10

Well Rich had remarkable foresight when he added this feature ten years ago 🙂 https://github.com/clojure/clojure/blame/master/src/jvm/clojure/lang/LispReader.java#L116

rickmoynihan13:09:38

Though I guess even then this was useful, even then… more so now we have the clj tools

dominicm14:09:20

This was clearly always the plan 😛

Alex Miller (Clojure team)15:09:49

Rich plays the longest game

dominicm15:09:08

I'm waiting for an IDE for clojure to appear in the clojure codebase.

Joe Lane23:09:05

Oh man this comment is going to keep me up tonight.

sparkofreason15:09:48

I need to use gen-class it implement an abstract Java class, but am having no luck getting it to load in the REPL for cursive. I assume it needs to be AOT'ed to be present on the classpath for clj. How is this accomplished with deps.edn? Or do I need a separate tool?

sparkofreason16:09:44

If I use compile and add classes to :extra-paths I get this exception on import.

niquola16:09:21

@aitem i’m curious too how distribute clojure closed source jars. How datomic is distributed? May be @alexmiller help us.

Alex Miller (Clojure team)16:09:31

Don’t know - I’m not on the Datomic team :)

niquola17:09:17

Who can we ask about this?

seancorfield16:09:26

@rickmoynihan Looking at that code makes me wonder what #< is for since, right now, both in EDN and Clojure, the reader for that simply throws an exception.

rickmoynihan16:09:01

@seancorfield: yes that’s a curious one

seancorfield16:09:45

I'd forgotten about ## as well -- and #! was new to me too.

dominicm16:09:57

#<foo> might be something?

rickmoynihan16:09:54

yeah ## was new in 1.9

seancorfield16:09:04

Can you override how #< is read? Or do you mean "reserved for some future, unknown purpose"?

rickmoynihan16:09:41

I didn’t think the reader was extensible/overridable; at least not beyond tagged literals.

dominicm17:09:18

@seancorfield I'm guessing a bit.

mfikes17:09:04

#< is for values that have no way to be read

andy.fingerhut19:09:40

Wow, I had never noticed that #! special case in the Clojure reader before. I won't say I never saw it, because I am sure I looked at the linked group of source lines at least a dozen times over the years.

borkdude20:09:00

what’s an example with #<?

andy.fingerhut20:09:42

As in, is there some object that will print as a sequence of character beginning with #< ? I don't know if there is one today.

andy.fingerhut20:09:14

Scanning through the Clojure implementation for print and pprint I didn't notice any such case.

Alex Miller (Clojure team)21:09:33

I think that’s just reserving space in the reader

gfredericks22:09:43

it was used for everything prior to #object wasn't it?

👍 4
Alex Miller (Clojure team)22:09:19

You think it’s that old object syntax?

gfredericks23:09:23

my interpretation was always that #<> was the way unreadable things were printed, and the #< entry in the reader was to produce the "unreadable form" exception whenever you accidentally tried to read those things

gfredericks23:09:41

here's the reader error messages from 1.2.1:

user=> (-> (Object.) pr-str read-string)
java.lang.RuntimeException: java.lang.Exception: Unreadable form (NO_SOURCE_FILE:0)
user=> (read-string "#,comma")
java.lang.RuntimeException: java.lang.Exception: No dispatch macro for: , (NO_SOURCE_FILE:0)
so I thought of the #< codepath as the way to avoid the less helpful No dispatch macro for: < message you'd get otherwise

gfredericks23:09:00

and it's still useful today for reading data produced by older clojures