This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-11-15
Channels
- # announcements (1)
- # asami (29)
- # babashka (31)
- # beginners (48)
- # calva (39)
- # cljsrn (4)
- # clojure (56)
- # clojure-dev (51)
- # clojure-doc (3)
- # clojure-europe (40)
- # clojure-gamedev (13)
- # clojure-italy (22)
- # clojure-nl (3)
- # clojure-uk (5)
- # cursive (9)
- # datomic (184)
- # events (7)
- # fulcro (8)
- # graalvm (2)
- # jobs (1)
- # malli (6)
- # meander (1)
- # nrepl (5)
- # off-topic (10)
- # pathom (9)
- # polylith (33)
- # portal (2)
- # re-frame (7)
- # reagent (12)
- # releases (3)
- # remote-jobs (3)
- # reveal (27)
- # shadow-cljs (34)
- # sql (1)
- # vim (7)
- # xtdb (62)
Where do people put package-level documentation? Let's say I have an app with structure like:
myapp/src/
- users
- admin
- plans
- a.clj
- b.clj
- c.clj
...
Now I want to write some docs that apply to most of the things in the plans
directory.
E.g. In java, there's package-info.java
that can serve this purpose.Namespace metadata is probably the closest
@U064X3EF3 what do you mean by namespace metadata?
I would put higher-level docs in ns
docstring but here I'm asking about docs that apply to multiple namespaces.
I meant ns docstring. there is no other place
there's no equivalent of package-info.java
@U06BE1L6T here's https://github.com/clj-commons/rewrite-clj/blob/main/src/rewrite_clj.cljc
Is it docs for developers? Because I've seen people just put a README in a directory before. I've also worked on a project that had an "adr" (Architecture Decision Record" directory that would have a markdown file that discusses a "package" of namespaces.
Hi, can anyone confirm that containsAll()
implementation in PersistentQueue
is not correct? thx
public boolean containsAll(Collection c) {
for (Object o : c) {
if (contains(o))
return true;
}
return false;
}
So I'm interested in persistent batched queues, while reading the Clojure implementation, I found it :D
Anyone have any examples of the queue usage patterns Rich is talking about https://youtu.be/ROor6_NGIWU?t=1933? He talks about how the queues in java.util.concurrent are underused, and suggests that this might be because he didn't wrap them (as they can be used in their native Java form). Checking git history, looks like this talk was 9 years after his first cut of clojure.lang.PersistentQueue, so it seems like he's talking about something other than this.
I can understand the principles of what he's saying and it makes good sense, but I'm having a hard time imagining how the plumbing fits together
core.async incorporates a lot of these ideas
PQ (being persistent) is not really relevant, since it's persistent (I rarely use it in anything other than a single-threaded context)
the Deque / Transfer stuff in juc is probably the most interesting for the things he's talking about here, and core.async channels have a lot of the Transfer queue semantics
Oh, I was scouring the source of core.async for java.util.concurrent and then realized I might have misunderstood you – do you mean that core.async is essentially the Clojure equivalent he was saying hadn't yet (at this point) been written?
I think the kernel of the ideas were probably there at that point
Got it. I'll look into guides on use of core.async then. Thank you!
and eventually became core.async
Clojure Applied has a couple chapters on core.async
I want to create something like a type alias for ExceptionInfo
— i.e. a class that extends it but just slaps a new name on it and otherwise delegates everything to the original class. What's the easiest way to do this?
https://github.com/redplanetlabs/defexception does exactly this
neat!
the whole point of ExceptionInfo is it carries a data map that you can add additional information to
I'm interfacing with code written by others and I want to be able to throw something that acts exactly like an ExceptionInfo but has a different class name.
(so that calling code can catch this exception type and ExceptionInfo separately)
(I want it to work like ExceptionInfo because I like the way ExceptionInfo works)
it's probably easier to re-implement IExceptionInfo and make a new type, than to proxy or subclass ExceptionInfo itself
there's almost nothing in ExceptionInfo
it's just an exception carrying a map
i’ve been reading about protocols and how most of the clojure.core
functions in the java implementation use interfaces whereas the javascript implementation use protocols. (see this discussion https://stackoverflow.com/questions/27728133/extending-clojure-core-protocols about nth
for an example). i realize the reason clojure didn’t switch over at the release of 1.2 was backwards compatibility and we’re now well past when any such breaking changes would be considered. but has anyone ever attempted to reimplement the clojure.core
functions with protocols as “clojure 2.0” library?
not to my knowledge. it would dramatically affect the java/clojure split and how collections were implemented I think. certainly clojurescript is the best reimagining by the person with the most context :)
yeah, it makes sense from a pragmatic standpoint, as interfacing with java is a big reason to use clojure, but it’s a pain point when working strictly within clojure that the existing architecture isn’t enough to do this stuff. i’ve never actually looked at clojurescript’s core library or how it’s implemented. maybe i’ll take a wack at it myself to see how things break!
if you do, I have been told that looking at the very early commits of clojurescript (not where it is now) is probably the best entry point
Fair enough. Is gen-class
the way to go here, or is there some other, simpler way of doing it?
I guess you have to extend something to make it an exception, so either gen-class or proxy
Alright, thanks 🙂
In a ring app, how do i access the body of a text/plain
POST ? My repl just hangs when i attempt to slurp
the body. The body shows #object[org.eclipse.jetty.server.HttpInputOverHTTP 0x4f4b65da "HttpInputOverHTTP@4f4b65da[c=0,q=0,[0]=null
params shows {}
the syntax in alt!
has me confused. i'm trying to exit a go-loop
through a signalling "exit channel". would this be the right approach?
also, does alt!
park the calling thread? (blocking-operation ...)
here runs inside it's own thread
.
(the above code works, I'm just not sure I'm getting what I want in terms of not blocking the calling thread with blocking-operation
)
if blocking-operation is truly blocking, then you shouldn't do this in a go-loop at all
well, it's actually a long polling HTTP call, occasionally returning data to be processed. when no data is available, it blocks.
well if you do that the right number of times, you will block your entire app
yes, that would be fine