This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-04-08
Channels
- # architecture (8)
- # boot (18)
- # cider (33)
- # cljs-dev (35)
- # cljsrn (3)
- # clojure (77)
- # clojure-dev (6)
- # clojure-dusseldorf (1)
- # clojure-russia (1)
- # clojure-spec (4)
- # clojurescript (40)
- # cryogen (1)
- # cursive (4)
- # dirac (2)
- # emacs (1)
- # figwheel (10)
- # funcool (2)
- # hoplon (21)
- # incanter (2)
- # leiningen (1)
- # lumo (44)
- # off-topic (2)
- # onyx (53)
- # overtone (5)
- # pedestal (8)
- # re-frame (9)
- # reagent (37)
- # rum (9)
- # spacemacs (16)
- # sql (2)
- # testing (1)
- # unrepl (4)
- # untangled (4)
- # yada (16)
@bradford I use https://github.com/weftio/gregor minimal and straightforward
question to all: is there a way to do “quick surveys” here or a dedicated channel to do this? I’m trying to figure out what’s the split in the Clojure community in here between Postgres vs MySQL (for example)
I normally just do something like this.... If you use X reply with :thumbsup: if you use Y reply with :thumbsdown:
@byron-woodfork thanks for the idea 🙂
No prob!
Gregor
Used in production
Also recommend https://github.com/tolitius/mount to help manage state. Worked as expected.
I think tolitius hangs out here.
@lmergen I also recommend straight Java Interop (this applies to almost any library with native Java bindings). 9 out of 10 times wrapper libs will miss some feature or forget to provide an escape hatch to something the Java libs expose. Or there can be bugs in the wrapper, or the wrapper could be written by someone who doesn't understand performance tradeoffs of Clojure abstractions...etc.
Also it's harder to get support questions answered if you have a wrapper library in the way.
@tbaldridge yeah that's what @michaeldrogalis just told me as well
True. Also, Open source means you can support yourself in many cases. Call me lazy but if I look at the source and feel it is simple enough for me to use and saves me time I go for it. Consulting will do that to a man.
Heh, @nbomberger consulting turned me cynical. I got tired of fixing bugs in OSS code written by people who didn't understand the needs of a system in production. As my co-worker explained here: https://stuartsierra.com/2013/07/28/the-amateur-problem
(reminder to read amateur = "not doing it for money" not "unqualified")
as with all things, it's a trade off. I personally find myself choosing libraries based upon what others use. would be good if there is a reputation system some way.
Github stars!
more seriously, number of issues closed in the last 12 months
"Java vs. wrapper" as with everything follow the "it depends" formula. in case of kafka, they keep it in good scala traditions and break backwards compatibility every time someone wakes up and decides to rename a method or a property. having consistent API, via a wrapper (could be a Java wrapper btw), does help. There is also a "baggage effect": when you carry helper functions for "this library" from project to project, and then decide: "why don't I just decouple it into its own thing + someone else may find it useful". As with anything, all general statements "use this, don't use this" stay.. general. "context" is king. It all comes down to understanding Java itself, a concrete library in question and the Clojure code that helps with it. For example I would rather use https://github.com/weftio/gregor than kafka Java API, since I understand its code, the library behind it + what and why it wraps. if I find something missing / wrong, I am going to submit a pull request.
defstruct v.s. defrecord question: why shouldn't I use a plain struct which means the clojure-like key syntax, and use records which require the java interop dot notation and all of that? I just need a repeating structure of data, and figured I'd use a defstruct rather than just a regular map, just to enforce the structure
why would records require dot notation for anything?
well I saw this example in the docs: https://clojuredocs.org/clojure.core/defrecord#example-589e0ac5e4b01f4add58fe45
that's a bad example
when you run (defrecord Foo [])
clojure automatically creates ->Foo
which is a function
and it also creates map->Foo
which takes a hash-map
it would be more idiomatic if it used ->record-class
instead of record-class.
also, it's too bad that none of the examples show usage of the map->Foo
style constructor function
eg. (map->record-class {:alpha 1 :beta 2})
to sum up my understanding then, so then one should really always prefer records over structs as the docs say?
yes - I have yet to see a reason to use a struct in new code
well - the code works, it's just not doing things the way we usually would
no need to be so gentle, I'd call it wrong if the sole example given in a doc is non-idiomatic
yes, it generates ->Foo and map->Foo
->Foo is positional, map->Foo uses arg names in a hash-map
what might be an intuition to help me flow along with map->
being a constructor prefix?
-> commonly indicates a conversion of types
err, at least often? hah
now that I check, that isn't used in clojure.core though
except Throwable->map - that's one
there aren't many records in clojure.core
I think clojure.core would just use java instead of a record type
map->Foo
looks very intuitive now in context of giving it a map to initialize the record
@noisesmith thanks!
still feeling a bit odd using objects in clojure (records now) but I guess enforcing a certain constraint on data has its price 😄 otherwise I'd use a plain map if I felt I can do without an explicit constraint
need some macro help. my app code looks like this: (dom/lambda [bindValue] (str "hello: " bindValue))
. My dom/lambda macro tries this: (let [bindValue "{{foobar}}"] (map eval (rest args)))
. When I eval the app code, I get “Unable to resolve symbol: bindValue”. What I want in this case is “hello: {{foobar}}” What I’m trying to do is use the binding syntax for sth that is not really a fn definer; lambda returns some data, not a function. So I guess my question is: what mechanism can I use (e.g. let) in my macro so that I can bind syms in the body at compile time. if that makes sense.
p.s. if it helps, I’m trying to put a clojure syntax on Polymer binding annotations https://www.polymer-project.org/1.0/docs/devguide/data-binding
@mobileink probably need (let [~'a :foo] ~'a)
or (let [a# :foo] a#)
. Might want to skim over https://aphyr.com/posts/305-clojure-from-the-ground-up-macros if you haven't worked with them a lot.
thanks. problem is the body is passed to the macro so i can't use quoting with e.g. a#. it occured to me after i posted the the source for defn or fn might tell me what i need to do. my dom/lambda is essentially a data lambda. thanks for the link, haven't seen that one before. i've done a fair amt of macro work but have never really mastered them - i usually end up beating on them till they seem to work, even if i don't understand why.😄
also, in my macro, the above let expression is unquoted, and it's what fails at compile time. but it seems like it should work. any idea why it doesn't?