Re: How to make a static variable dynamic at runtime?

2015-07-21 Thread Surgo
Not that it's the answer you're looking for, but usually this is when you rewrite the code you're testing to use dependency injection (ie, take the var of interest as an argument instead of a global or in its lexical environment). -- Morgon On Tuesday, July 21, 2015 at 10:54:42 AM UTC-4, Yuri

Re: Using core.match in tests?

2015-06-22 Thread Surgo
This might be a bit of a strange or off-topic segue but it got me thinking. Is there an idiomatic way to handle optional dependencies in Clojure? Ideally, this macro would be a part of core.match itself (submit a pull request, get it merged, and whatnot). Of course, you don't want core.match to

Re: breaking homoiconicity?

2015-06-20 Thread Surgo
> > Thanks, that's helpful for me. By chance do you know if the class is > natively recoverable from the TypeName for Clojure/Java? Class/forName > can't roundtrip that string. I could implement a look-up table to > translate between the two formats, but that seems rather kludgey. > I actua

Re: Making Java serializables transparently printable and readable

2015-06-17 Thread Surgo
rally sound advice, but session cookies in Ring are encrypted > and MACed, so they can't be changed by the client and remain valid. > However, cookie sessions do have the disadvantage that they're hard to > revoke. > > On 17 June 2015 at 14:27, Surgo > wrote: > &g

Re: Making Java serializables transparently printable and readable

2015-06-17 Thread Surgo
Let's not get into the motivation behind this too much -- the exact same serialization problems exist if you write out the session to a database. Ring also encrypts the cookies so the above issue is not a problem, it's only on you to actually choose and protect your encryption key. I came acros

Making Java serializables transparently printable and readable

2015-06-16 Thread Surgo
I've been working on a Ring app that involves storing sessions as cookies, and within the session there are a couple Java objects that implement java.io.Serializable. I was somewhat surprised to find that the print-dup multimethod didn't have native support for Java Serializables, though I can

Re: Protocols/multimethods vs core.match

2015-05-15 Thread Surgo
core.match compiles down to case, does it not? So the comparisons here are similar: http://insideclojure.org/2015/04/27/poly-perf/ -- Morgon On Friday, May 15, 2015 at 2:57:23 PM UTC-4, tbc++ wrote: > > One big thing to consider is that core.match is closed dispatch. If you > write a function t

Re: Clojure needs a web framework with more momentum

2015-05-07 Thread Surgo
One way to think about documentation is this: you've just written this great and useful library! You surely want it to be useful and people to actually use it, right? (See earlier in the thread about Pedestal.) Well, the only way you'll reach that goal is by having solid documentation that can

Re: how goeth the STM experiment?

2015-05-06 Thread Surgo
I'm not saying this is everyone's experience or anything, but at times I have at times considered some deeper STM-work with agents but I could not seem to penetrate the documentation at the time. I do not know if it's different now -- Morgon On Wednesday, May 6, 2015 at 5:38:08 PM UTC-4, James

Re: Clojure needs a web framework with more momentum

2015-05-06 Thread Surgo
Projects like Pedestal do themselves a tremendous disservice with their poor front pages. It's probably an amazing project but it was very difficult to get a sense from the README.Md what it could actually do for me. Whoever owns the Pedestal project, please add a section to the top that is lit

Re: Clojure needs a web framework with more momentum

2015-05-05 Thread Surgo
Maybe I don't entirely understand what a web framework is, but it seems to me like Immutant is an example of something that might fit into a lot of the buckets. Could someone explain how that isn't the case? Thanks, -- Morgon -- You received this message because you are subscribed to the Googl

Re: String-friendly first/rest?

2010-12-08 Thread Surgo
> (rest anything) returns a seq, by definition. It's not about Strings, it's > the contract of rest. A String is not a seq, but it's viewable as a seq, in > which case each element of the seq will be a character of the String. > > Note that this is not particular to String, but to almost any clojur

Re: Lots of newbie clojure questions

2010-12-08 Thread Surgo
> > Not really. (...) is a non-atomic s-expression. If it's evaluated > > unquoted, the first nested s-expression is evaluated and if it's not > > callable an exception is thrown. Macros, special forms (which are sort > > of like system-internal macros and are used to build all the other > > macros

String-friendly first/rest?

2010-12-08 Thread Surgo
To help myself learn Clojure, I figured I would write a pattern matching / destructing macro to better look like languages I'm more familiar with; i.e., destructuring by [first|second|rest] instead of [first second & rest]. To do this I'm turning the aforementioned vector into a string (via str) an