This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-08-28
Channels
- # aleph (1)
- # announcements (16)
- # bangalore-clj (1)
- # beginners (78)
- # cider (109)
- # clara (3)
- # cljdoc (6)
- # cljsjs (3)
- # clojure (209)
- # clojure-dev (11)
- # clojure-europe (1)
- # clojure-france (9)
- # clojure-italy (13)
- # clojure-nl (3)
- # clojure-spain (2)
- # clojure-spec (19)
- # clojure-uk (50)
- # clojurescript (41)
- # clojutre (2)
- # core-async (45)
- # cursive (2)
- # datomic (14)
- # emacs (6)
- # figwheel-main (1)
- # fulcro (101)
- # graalvm (1)
- # graphql (3)
- # jobs-discuss (3)
- # kaocha (12)
- # leiningen (8)
- # music (4)
- # off-topic (47)
- # parinfer (8)
- # pathom (17)
- # pedestal (53)
- # re-frame (47)
- # reagent (22)
- # reitit (4)
- # shadow-cljs (49)
- # tools-deps (87)
Does deps have support for profile injection of code, similar to the same lein feature?
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 … https://pragprog.com/book/mbfpp/functional-programming-patterns-in-scala-and-clojure
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.
One hilarious part is that many Java examples translate to 2 lines of Clojure or “use a map”
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
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)
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).
It's nothing to do with that.
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
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.
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 🙂
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
with respect to something like Datomic, that sentence starts "If I modify a Program"
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
legally, there are a lot of clarifications to the definitions of words in that statement before it can be evaluated
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?
The vast majority of people building stuff with Clojure are not "modifying the Program" because they are just using Clojure as-is.
I would say no
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
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?
they are both weak copyleft licenses, so similar in that regard
but they differ in their obligations and probably other details like patent protection
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.
At Cognitect we have chosen ASL2 at times when we thought it was a better match
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.
well, look at what happened in React
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.
I think AGPL / EPL are probably not compatible w/o some kind of exception like the classpath exception
which should work fine but is more complicated
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: https://github.com/metabase/metabase/commit/666b1b453a71a1fca19e7b81739a58ce7fa45a14#diff-61e0bdf7e1b43c5c93d9488b22e04170)
>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.
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]]
(eval
`(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 - https://github.com/ahungry/determinism (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.
(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."
[n]
(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)))
@my-dataset)
;; 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
Which would give you lower results, not higher 🙂
No, this makes sense
First 0 was processed
0 -> 0
Then 4 was processed
4 -> 4
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)
Finally 5
So this makes perfect sense.
@hiredman - yeah, good call
Has anyone used tap> in tests? Is it a good or bad fit for detecting actions taking place during integration 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)
That makes sense
> not sure where #date comes from
#date
is 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
!
Here's a blog post on this that I found: https://xivilization.net/~marek/blog/2013/09/17/clojure-and-hygienic-macros/ I think Clojure allows a programmer to write hygienic macros!
with the use of syntax quote resolution and gensym, it's not really an issue in Clojure?
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/foo
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
user=>
i would've sworn i broke something like that once but i can't seem to find what it was
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)
This particular case of a failure at option fan-out is one where I think we could greatly improve the error message
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.
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.
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.
How many times have I seen you write that in here now?
Hahaha... it always bears repeating!
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 😐
Have you considered getting aggressive about it from the library level? Eventually that is.
Beyond the big, bold Project Status section? https://github.com/clj-time/clj-time#project-status
Far too subtle sir.
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? https://github.com/andrewmcveigh/cljs-time
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
https://github.com/henryw374/cljc.java-time -- I think that was announced at Clojure/North earlier this year?
Is this the Clojure/north talk you were thinking of or were there two time libraries introduced?
ahh, it seems tick
might be a higher level library on top of this cljc.java-time
. 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 https://github.com/seancorfield/next-jdbc
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!)
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
oh the arities
I didn’t see that!