Fork me on GitHub

Does deps have support for profile injection of code, similar to the same lein feature?

Alex Miller (Clojure team)01:08:34

Aliases can be used to do certain things that profiles can but they differ


Couple of days ago I asked about ‘patterns’ here - I completely forgot that I have this on my bookshelf …

Alexander Stavonin01:08:39

how good it it? would you recommend to spent time reading the book?


This was one of the first few books I read when learning functional programs. Liked it.

👍 4

I’m still reading it but I like it.


One hilarious part is that many Java examples translate to 2 lines of Clojure or “use a map”


Hello. Does anyone use Yada? Im trying to get started


what do i make of this?


According to my search on Bing, that's most likely due to IP6 vs IP4 issues @norilinoriginal


How are you starting the Socket REPL? What platform are you on?


Hmm...I am a bit confused on EPL / GPL incompatability that I am reading about. Statements such as "Clojure is EPL (1.0) and therefore any code written under GPL, but compiled with clojure libraries (even core language features themselves) is therefore impossible to distribute legally" (paraphrased) - yet, if I compile some C with gcc, that does not mean my compiled C code must be GPL just because gcc is gpl. So, why would compilation of a language (clojure) to java byte code imply that resultant byte code must be EPL?


Where did you read that statement? It doesn't sound right to me.


or, if I type code with Emacs, which generates code / text based on my interaction with the program, despite Emacs being GPL, it does not mean that my resultant source code is needing to be GPL


let me plop down some of the links I've been reading tonight


it would be one thing if it was a user package like clj-http or jdbc or something that was epl and thus incompatible, because that would be closer to glibc and its LGPL license that accommodates gpl use (I think glibc is lgpl)


but to say, a core language would ban all gpl derivatives?


GPL is a very problematic language from a programatic point of view. Lots of other licenses are not compatible with it -- and it's the GPL's "fault" because it is, essentially, a "viral" license.


But I don't think code written in any of the GPL lisps requires the derivative work to incorporate the host language's license choice do they?


When I worked at Adobe, the legal team almost never approved use of GPL software if it might need to be combined with anything else (rather than just being a standalone tool).


guile-scheme is gpl right? but surely any scheme I write does not have to be gpl


It's nothing to do with that.


(maybe it does 🤷 )


It's to do with combining and distribution of code that is under different licenses.


guile is lgpl, so I suppose that's why it never has surfaced in things I've come across as a show-stopper as far as licenses are concerned


Your problem isn't Clojure being EPL per se, it's about combining and distributing bundles of code as derivative works.


ugh, what a cross-roads, when ideology meets preference - clojure is such a great language, but to use a language constrained by a license that forces almost all things built on it to match the same license - maybe a language built with all of its runtime as GPL would be in the same boat


but it seems all the "gpl" flavor languages+stdlibs use lgpl to work around that


The fault is GPL, not EPL.

✔️ 4

so derivatives can be mit / bsd / epl -basically anything


you say potato, I say potato


EPL is very friendly to companies -- so Clojure is easy to use for businesses.


If you write software under the GPL, a lot of companies won't touch it (unless it is a completely standalone tool that they don't have to combine anything with).


If so, is there any chance I could get a license of your program under the Lesser GPL? You can ask, but most authors will stand firm and say no. The idea of the GPL is that if you want to include our code in your program, your program must also be free software. It is supposed to put pressure on you to release your program in a way that makes it part of our community. You always have the legal alternative of not using our code.


So - is it correct that if a company writes a commercial app in clojure, due to EPL, anyone they distribute it to would have to also distribute the source code?


No, absolutely not.


Datomic is closed source. REBL is closed source.


Do I need to include the source code for such Program with the object code distribution? No. But you do need to include a statement that the source code is available from you and information on how to obtain it.


If I purchase dataomic or REBL, does someone tell me the source is available and how to obtain it?


No, those are not EPL-licensed.


That's my point, you can build non-OSS products using Clojure.


Are you sure the only reason they aren't subject to EPL is because Rich has a CLA for clojure? And thus full copyright of it?


he / owners of clojure code can relicense as non-epl their entire language, but only they have that privilege


This isn't about re-licensing Clojure.


so, a derivative work (dataomic) can ignore the fact its host is EPL

Alex Miller (Clojure team)03:08:14

I feel like you are concluding things without actually reading or understanding any of the documents


I was trying to figure out a polite way to say this 🙂

Alex Miller (Clojure team)03:08:37

sorry if that wasn't polite :)


"If I modify a Program licensed under the EPL and distribute the object code of the modified Program for free, must I make the source code available? Yes. By distributing the modified Program, even if it is only a free version of the object code, you are obligated to make the source code to the modified Program available to others."


Not intentionally - I have been digging through old postings but it would help if some official document / FAQ clarified all of this closer to the context


I read through the google groups posting and consideration of epl 2 (and rejection) and have been trying to do a thorough investigation - a few of my comments are conjecture / my own assumption yes

Alex Miller (Clojure team)03:08:21

with respect to something like Datomic, that sentence starts "If I modify a Program"

Alex Miller (Clojure team)03:08:31

Datomic does not modify Clojure and is not itself licensed under the EPL


Is this statement true or false - "Code written and compiled into the same JVM byte code space as clojure core is subject to the EPL 1.0 license"?


If it is false, then I believe if I use no 3rd party libraries, I can build a clojure GPL ecosystem


if it is true, then I can't

Alex Miller (Clojure team)03:08:50

legally, there are a lot of clarifications to the definitions of words in that statement before it can be evaluated

Alex Miller (Clojure team)03:08:38

and the notion of "linking" in particular with Java bytecode is a particularly thorny one


if the clojure jar functionality (the language primitives) are extended with user defined code, even as simple as a "hello world" main call - isnt that a modification of the original program?


because the program and what it does when executed has now changd


The vast majority of people building stuff with Clojure are not "modifying the Program" because they are just using Clojure as-is.


it may not be a modification of the source files


if I #include <gpl-library.h> in a C program and write my own functions extending it


thats not a modification to the gpl program?

Alex Miller (Clojure team)03:08:45

I'm not qualified to answer that question


I'm sorry if any of this is coming off trollish, its not the intent at all, i'm trying to grasp at and understand how this all weaves together, and it seems like while some of the old article postings have cited a firm stance between Eclipes group and the FSF, the open source community itself, close to the language, still has a non-concrete answer

Alex Miller (Clojure team)03:08:46

and I'm not sure it's even a comparable question given that epl and gpl probably have different definitions of the words you're using


I just realized that the Google Groups thread you linked to includes my answers to these questions in some detail so I'm just kind of repeating myself.


So - ignoring the GPL compatibility issues - EPL is most comparative to the LGPL? Linking code is fine, and proprietary binary shipping without source available is also fine, but if you modify an included lib itself, that must be a shared modification?

Alex Miller (Clojure team)03:08:35

they are both weak copyleft licenses, so similar in that regard

Alex Miller (Clojure team)03:08:20

but they differ in their obligations and probably other details like patent protection


the GPL website has an approximately 200pg faqs page that might help here


LGPL is more restrictive than EPL in terms of usage of code released under those licenses.


I guess I'd turn this around and ask: do you have a specific use case regarding code or an application you're writing and distributing, where you need to understand what licenses you can use for that code/application, when working with Clojure? @m131


yes, about 20 or so github things I'm tinkering on / working with, and I choose AGPLv3 as my de-facto license on the majority of them


I'm fairly strongly "anti" GPL/LGPL precisely because of the difficulties they cause for anyone downstream trying to use them in conjunction with other software.


which, seems my license choice may be wrong/need to be reworked, or its impossible for anyone to use under my combination of language and my license choice - granted i'm only distributing my own created clj source code and no resultant dependencancies


I tend to choose ASL -- Apache Source License -- by default, unless I'm writing a Clojure library in which case I use EPL. I like both licenses.

Alex Miller (Clojure team)03:08:24

At Cognitect we have chosen ASL2 at times when we thought it was a better match

Alex Miller (Clojure team)03:08:37

Like the transit libs, transducer libs, etc


Yup, makes sense to me.


When I worked at Adobe, we had to ask one OSS project to consider relicensing from LGPL to ASL because of the way it generated code and then expected you to combine your code with it. The project changed its license (otherwise we would have found another project or built something ourselves). A lot of people starting OSS projects don't think about the implications of the licenses they choose.

Alex Miller (Clojure team)03:08:25

well, look at what happened in React

Alex Miller (Clojure team)03:08:51

or even step back one step to consider projects without a CA where they don't even have the ability to relicense in the first place


True, which is the vast majority of small OSS projects out there.

Alex Miller (Clojure team)03:08:02

I think AGPL / EPL are probably not compatible w/o some kind of exception like the classpath exception

Alex Miller (Clojure team)03:08:33

which should work fine but is more complicated

Alex Miller (Clojure team)03:08:01

Metabase is a Clojure project licensed AGPL with exceptions btw


maybe if that is good enough for metabase with 15,000+ github stars, its good enough for my tiny works then (I did see this commit earlier today:


>The idea of the GPL is that if you want to include our code in your program, your program must also be free software. It is supposed to put pressure on you to release your program in a way that makes it part of our community.


Just clarifying exactly what the difficulty is that's caused.


I default to GPLv2 for stuff that I want to stay in the open-source space and ad-hoc permissive/unpermissive licenses for other use cases.


So, technical question - I want to define a var in ns bar, while I am currently in ns foo - is the best way to just use in-ns? or some other means?


(defn proxy-def
           "Redefine a function with the wrapper around it. k = Symbol, v = Var to Fn."
           [[k v]]
            `(def ~k ~(proxy-fn (deref v)))))


Why do you want to do that? (genuine question) It seems like a bad idea to me.


I want to implement something in the flavour of the robert-hooke package (ala, emacs lisp defadvice) for runtime tracing/storage of function inputs/outputs and input types + output types - (excuse the cheesy name)


if you peek at the readme, the intent is that I would have an sqlite database that I could then augment an IDE with


Take a look at how instrument in Spec is defined.


so i hover on function foo - it shows me the last N inputs/outputs it received at runtime on dev server etc


(as I suspected, Spec uses alter-var-root to replace an existing definition with a new version)


No need for eval etc.


thanks! I will give that a shot


this is an interesting one


what is the reason for this evaluation result?


(def my-dataset (atom {}))

         (defn fetch-data!                                                                                                                                               
           "Simulate a slow data condition and return back the number given,                                                                                             
           with the side effect of keeping a running sequence of n / sum."                                                                                               
           (Thread/sleep 1e2)                                                                                                                                            
           (swap! my-dataset (fn [m] (conj m {(keyword (str n)) (+ n (reduce + (vals m)))}))))

         (defn get-data []                                                                                                                                               
           (reset! my-dataset {})                                                                                                                                        
           (dorun (pmap fetch-data! (range 6)))                                                                                                                          

         ;; With pmap, this is produced?                                                                                                                                 
         (time (get-data))
         "Elapsed time: 100.93236 msecs"
         {:0 0, :1 25, :2 13, :3 7, :4 4, :5 54}


without pmap, using normal map, it would calculate as expected - the max value being 31 in the 5 slot: {:0 0, :1 1, :2 3, :3 7, :4 15, :5 31}


i could understand if the sums were in the wrong slot due to pmap chunking out the data, or if they were coming in at a lower total than expected due to the function application in the swap lexically scoping things oddly - but how is it getting up to 54?


While swap! itself is atomic, how does vals work?


its supposed to just pull the vals off a map, so {:x 1 :y 2} would result in [1 2] (or maybe (1 2))


That’s not what I mean


could a map exist in a state where it has a key but no val?


Which would give you lower results, not higher 🙂


yea...which is why I am very confused how it would get to 54


No, this makes sense


First 0 was processed


Then 4 was processed


Then 3 was processed


3 -> 7 (3 + 4 + 0)


Then 2 was processed


2 -> 13 (2 + 7 + 4 + 0)


Then 1 was processed


1 -> 25 (1 + 13 + 7 + 4 + 0)


So this makes perfect sense.


Put a watch on the atom and you'll see what it is swapped from to every step


thanks all


Has anyone used tap> in tests? Is it a good or bad fit for detecting actions taking place during integration tests?


you mean leaving tap> in production code to use it for tests?


I'd say tap> is like debugging prints, but with values instead of strings, so it should not be in production code. Why not use with-redefs to get a peek into implementation?


I see experimenting with using it as a mock, where I might previously have used something like core async channels in my mock


Please help, why would (prn {:till-date #date "2019-01-01"}) fail with No reader function for tag date. no reading is happening env: (emacs + cider)


#inst "2019-01-01"


not sure where #date comes from


reading is happening when you send this form to repl


That makes sense


> not sure where #date comes from #date is custom tag


You need a custom reader for your custom tag


I am not reading the custom tag, I am trying to serialize it


@kirill.salykin you can create a tagged-literal object


Thanks, will look into it just found that tick procides #time/* tags will not reinvent the wheel and use it Thanks for the tick !

💯 4
👍 4

are there any plans for hygienic macros in clojure?


Here's a blog post on this that I found: I think Clojure allows a programmer to write hygienic macros!

Alex Miller (Clojure team)16:08:48

with the use of syntax quote resolution and gensym, it's not really an issue in Clojure?


as long as i remember to # all the things


if you don't you will usually get an error

Alex Miller (Clojure team)16:08:00

well due to autoresolution, clojure will resolve the things you forgot and usually cause an error


user=> (defmacro foo [x] `(let [y 1] ~x))
user=> (let [y 2] (foo y))
Syntax error macroexpanding clojure.core/let at (REPL:1:12).
user/y - failed: simple-symbol? at: [:bindings :form :local-symbol] spec: :clojure.core.specs.alpha/local-name
user/y - failed: vector? at: [:bindings :form :seq-destructure] spec: :clojure.core.specs.alpha/seq-binding-form
user/y - failed: map? at: [:bindings :form :map-destructure] spec: :clojure.core.specs.alpha/map-bindings
user/y - failed: map? at: [:bindings :form :map-destructure] spec: :clojure.core.specs.alpha/map-special-binding


i would've sworn i broke something like that once but i can't seem to find what it was


guess i'm just misremembering things.


that spec error looks pretty scary though haha

Alex Miller (Clojure team)16:08:54

It’s basically saying that there are several things it possibly expected to find but what it found was none of those - expected simple-symbol?, or vector, or ... (all the potential destructuring forms)

Alex Miller (Clojure team)16:08:54

This particular case of a failure at option fan-out is one where I think we could greatly improve the error message

Alex Miller (Clojure team)16:08:29

Imo, the next best problem to attack in this area


so basically there are facilities that guide you towards hygenic macros, but they aren't as strong as say racket's, and are easier to ignore, but that makes the macro system much simpler to implement and understand


just bought my clojure conj ticket, nearly forgot so I thought i'd throw a reminder up here 🎗️


See you there!


I’m working on a library, and borrowing a txt definition file from a python lib that is inspiring mine. I realized I don’t actually know where the best/idiomatic place to stick these kind of things is… under /resources? Under /src/my/ns-prefix/? I’m using tools.deps and haven’t really needed to produce a jar.


the file in question gets read at startup and defines a registry of dimension units


so let’s assume that it gets slurped & parsed or such when my downstream project starts up, which I presume means directly relying on a filepath wouldn’t be a very hot plan.


If it is read-only, I’d go with accessing it as a resource.


it is read-only … so that’d be and living under /resource, I guess.

👍 4

Afternoon! Does anyone have any recommendations RE: Clojure libraries that they feel are good examples of using protocols?


clj-time imo


I followed that lib for some good examples of using protocols


clj-time is deprecated. Please don't use it. Use Java Time directly or one of the wrapper libraries if you must.

☝️ 8
Suni Masuno19:08:34

How many times have I seen you write that in here now?


Hahaha... it always bears repeating!

Suni Masuno19:08:30

The curse of the successful package, it can never truly die.


I've only been getting "aggressive" about it since Clojure 1.10 made Java 8 the baseline. In theory, if you're on 1.9 or earlier and you're still on Java 7 or earlier for whatever weird reason, then clj-time is still useful. But I really don't want folks using it on new projects that run on Java 8 or later 😐

Suni Masuno19:08:17

Have you considered getting aggressive about it from the library level? Eventually that is.

Suni Masuno19:08:35

Far too subtle sir. troll

Suni Masuno19:08:44

Have you considered flashing text?


<marquee>STOP. USING. CLJ-TIME.</marquee> :rolling_on_the_floor_laughing:


Tangential, but there's no equivalent in CLJS to java-time is there? The only lib I've seen so far mimics the clj-time API, should it also be deprecated?

Suni Masuno19:08:18

Oh, now that's an actually interesting question


@U22M06EKZ The clj-time readme links to a clj/cljs project that is Java Time in clj and the equivalent in cljs

seancorfield20:08:53 -- I think that was announced at Clojure/North earlier this year?


This might be an option too.


Is this the Clojure/north talk you were thinking of or were there two time libraries introduced?


I just tried tick this morning on an exercism problem and it was pretty nice.


ahh, it seems tick might be a higher level library on top of this Sorry for any confusion.


This is a godsend. Since I looked at time libs in late 2017 I've been preparing to roll up my sleeves and wrap differing CLJ+CLJS libraries to achieve consistency in my own app. tick looks like exactly what I need -- I have some learning to do & thank you both @U04V70XH6 @U9J50BY4C!


@tkjone Feel free to look at seancorfield/next.jdbc as an example of a protocol-heavy library

🙏 4
Lennart Buit19:08:46

just wondering: why are some protocol fns in next.jdbc prefixed with a dash, and others are not. Privateness?


The - ones are "low-level" and have a wrapper function without - to provide multiple arities for convenience.


(and that's a very good question!)

Lennart Buit19:08:09

yeah, I was thrown off because all appear to have a wrapping function. I do the same, but I have a fn without a dash to be able to attach an s/fdef to

Lennart Buit19:08:18

oh the arities

Lennart Buit19:08:22

I didn’t see that!