Re: first time without state - and I'm lost

2020-06-15 Thread Ernesto
if you take a few moments to think about it, swap! shouldn't return an > atom etc., but I think it becomes clearer with force). > > On Mon, Jun 15, 2020 at 10:34 AM Ernesto Garcia > wrote: > > > > Hi, it's a long time that this question was posted, but I have fo

Inadequate behavior of agent await?

2020-06-10 Thread Ernesto Garcia
I have discovered that, in the case of an agent action exception, the behavior of agent await depends on timing: - If your await happens to execute after the action is completed, it will happily throw an exception that the agent is in a failed state. - If your await happens to execute before the

Re: Inadequate behavior of agent await?

2020-06-11 Thread Ernesto Garcia
Hey, thanks for the suggestions. ClojureVerse seems to be the most active forum? On Thursday, June 11, 2020 at 5:52:29 AM UTC+2, Sam Griffith wrote: > > You may want to ask this on ClojureVerse or on the official Q/A site at > https://ask.clojure.org/index.php/ -- You received this message bec

Re: Inadequate behavior of agent await?

2020-06-11 Thread Ernesto Garcia
ent action; why does it say "from this thread or agent" then? Am I misinterpreting something? Thanks, Ernesto -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note t

Re: first time without state - and I'm lost

2020-06-15 Thread Ernesto Garcia
st practices are still a topic of research. Clojure has taken the pragmatic approach of making purely functional code easy to write, but it doesn't reject the use of state, rather it provides well-behaved primitives like vars, atoms, agents, etc. Ernesto -- You received this message becau

Vars as global thread-locals?

2017-02-08 Thread Ernesto Garcia
of vars as global thread-local storage, by restricting their use to dynamic binding only. What is so bad about global thread-locals? It can't be the fact that they are global, as refs are typically made global. They also have a good thread-safe behavior. Thanks, Ernesto -- You re

Re: Vars as global thread-locals?

2017-02-08 Thread Ernesto Garcia
Hi Alex, thanks for your thorough response. It seems to me that Clojure vars are just not intended to be used as thread-locals in general. They happen to use thread-local storage in order to implement dynamic scoping, which is the original intent. That is why vars are either global (interned in

Making a Java class implement ILookup

2017-02-28 Thread Ernesto Garcia
ny other way to achieve this? Wouldn't it be better if ILookup were a protocol? Thanks, Ernesto -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new mem

Re: Making a Java class implement ILookup

2017-03-03 Thread Ernesto Garcia
On Tuesday, February 28, 2017 at 9:40:12 PM UTC+1, Alex Miller wrote: > > If it follows Java bean semantics, you can use the `bean` function to view > it as a map with properties as keys. > The class is not actually a bean. It contains a map, with a .getPropertyValue method, but it doesn't impl

Re: Making a Java class implement ILookup

2017-03-03 Thread Ernesto Garcia
On Wednesday, March 1, 2017 at 3:21:51 AM UTC+1, Mikera wrote: > > You might want to try implementing a small wrapper class that implements > ILookup. > > Then you can do something like: > > (:keyword (MyWrapper. my-obj)) > Yeah, but to be more convenient, it would need to return a wrapper in cas

Re: Making a Java class implement ILookup

2017-03-03 Thread Ernesto Garcia
On Thursday, March 2, 2017 at 3:36:53 AM UTC+1, William la Forge wrote: > > Alternative implementations for clojure maps are hard. You tend to use AOT > a lot, which is non-idiomatic. But a number of people have done this, > including myself. In retrospect, it isn't worth it. At least not most of

Re: Vars as global thread-locals?

2017-03-03 Thread Ernesto Garcia
On Sunday, February 26, 2017 at 6:23:28 AM UTC+1, Didier wrote: > > Dynamic scoping and Java ThreadLocals gives you equal functionality, so > I'd use them equally. This is because Clojure supports thread bound dynamic > scope. > I wouldn't say that. While dynamically scoped Vars are meant to be

Re: Vars as global thread-locals?

2017-03-09 Thread Ernesto Garcia
cross-processor synchronization primitive. Doesn't this hit performance? Or is access to vars not considered to happen frequently? Ernesto On Saturday, March 4, 2017 at 10:59:12 PM UTC+1, Didier wrote: > Hum, you're having me question myself. > > See, I don't think dynamically

Re: Vars as global thread-locals?

2017-03-09 Thread Ernesto Garcia
Thank you Alex! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, sen

Re: Vars as global thread-locals?

2017-03-20 Thread Ernesto Garcia
Thanks for your response Didier. On Friday, March 10, 2017 at 7:05:19 PM UTC+1, Didier wrote: > > But just to clarify, Java's ThreadLocal is an implementation of dynamic > scoping. > This is how I see it: A ThreadLocal is an object instance. It ensures a different object for each different thr

Re: Vars as global thread-locals?

2017-03-28 Thread Ernesto Garcia
create, if possible. Regression: The reason that I brought up this discussion is that I didn't understand why clojure.tools.logging uses a dynamic var for enforcing the use of a specific *logger-factory*. Does anybody have an explanation for that? Thanks, Ernesto > -- You received

core.async: Unbound channels

2019-07-03 Thread Ernesto Garcia
, so only channels at the boundaries would require to be bound? Channel limits are also much dependent on the particular process and environment. How would we write generic code that creates channels, if those need to be bound to limits unknown? Thanks, Ernesto -- You received this message

Re: core.async: Unbound channels

2019-07-04 Thread Ernesto Garcia
ng) > > On Wednesday, July 3, 2019 at 7:14:46 AM UTC-4, Ernesto Garcia wrote: >> >> You can create a unbound channel with (chan), but not if you use a >> transducer; (chan nil (filter odd?)) will raise an error that no buffer >> is provided. Why is this the case? >>

Re: core.async: Unbound channels

2019-07-05 Thread Ernesto Garcia
On Thursday, July 4, 2019 at 4:24:33 PM UTC+2, Matching Socks wrote: > > Ernesto, you may be interested in the informative response to this > enhancement request, https://clojure.atlassian.net/browse/ASYNC-23 > <https://www.google.com/url?q=https%3A%2F%2Fclojure.atlassian.net%2Fbr

Re: core.async: Unbound channels

2019-07-08 Thread Ernesto Garcia
I see. Bufferless channels are meant to be used within the core.async threading architecture, where there will be a limited number of blocked puts and takes. At the boundaries, channels with dropping or sliding windows can be used for limiting work. So, my original question actually turns into:

Re: core.async: Unbound channels

2019-07-11 Thread Ernesto Garcia
Thanks Alex! Correct, the channel implementation takes care that "transduced" channels always pass elements through the transducer and the buffer. Also, a FixedBuffer allows running out of limit for those cases, see this example with a FixedBuffer of size 1 making space for 4 elements: (def c

Re: Conceptual difference between map and class

2020-04-05 Thread Ernesto Garcia
In my humble opinion, main benefits of Clojure: - Development cycle: modifying and experimenting on a running program. - Treating data as maps. Direct and efficient immutability. - Macros: Though used very scarcely, it's good to know that you'll be able to extend the language from within if you

Re: Cannot sen msg to #clojure channel

2010-08-11 Thread Ernesto A.
You might want to check the FAQ at freenode.net. They even give you hints for setting up your client so that you don't have to manually register every time you log in. On Tue, Aug 10, 2010 at 10:44 AM, Laurent PETIT wrote: > You need to register with NickServ, e.g. > /msg NickServ identify > > I