Re: [ANN] Nightcode 2: Total Rewrite

2016-07-13 Thread Keith Irwin
Now a simple question…

How do you evaluate a form into the running repl?


> On Jul 13, 2016, at 7:12 PM, Zach Oakes  wrote:
> 
> If I get desperate I may do that, but the main users I care about are 
> beginners, and they generally have trouble installing CLI tools. I'm hoping 
> it is a trivial fix and I'll be able to get Boot working in 2.1.0 :)
> 
> On Wednesday, July 13, 2016 at 9:44:50 PM UTC-4, Mark wrote:
> How about, until the issues are resolved, you require boot to be installed?
> 
> On Jul 13, 2016 6:52 PM, "Zach Oakes"  wrote:
> That Boot tab is quite a tease ;) I wanted to finish support for it so bad, 
> but technical difficulties prevented me from doing it. I definitely plan to 
> still do so, and any help would be appreciated.
> 
> The issue is actually pretty simple: I need to be able to call Boot commands 
> without having Boot installed. I do so for Leiningen by literally adding it 
> as a dependency and calling its build commands programatically. Boot simply 
> isn't designed to work that way.
> 
> After talking to the Boot folks, they suggested I add Boot.java 
>  to my 
> project and start a process that calls its main method with the appropriate 
> task names. Easy enough, but that does not actually work. It turns out that 
> AOT compilation causes this java file to not behave correctly.
> 
> If anyone is interested in investigating this, I created a minimal case for 
> this issue here: https://github.com/oakes/boot-clj-issue 
> 
> 
> Once that is resolved, it will be pretty trivial to enable building Boot 
> projects.I actually would like to make the built-in templates use Boot by 
> default instead of Leiningen. Boot scripts in particular will be awesome for 
> beginners.
> 
> On Wednesday, July 13, 2016 at 6:44:01 PM UTC-4, Sean Corfield wrote:
> I see a Boot tab in the REPL area but looking at the source code, detecting 
> build.boot is disabled (and, indeed, I can’t get NC to recognize any of my 
> Boot-only projects).
> 
>  
> Can you speak to where you are on Boot support?
> 
>  
> Thanks,
> 
> Sean Corfield -- (970) FOR-SEAN -- (904) 302-SEAN
> An Architect's View -- http://corfield.org/ 
> 
> "If you're not annoying somebody, you're not really alive."
> -- Margaret Atwood
> 
>  
> On 7/13/16, 10:58 AM, "Zach Oakes"  on behalf of 
> zso...@gmail.com <>> wrote:
> 
> TL;DR: Nightcode, a Clojure IDE, just got a makeover: 
> https://sekao.net/nightcode/ 
>  
>  
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com 
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com 
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en 
> 
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+u...@googlegroups.com .
> For more options, visit https://groups.google.com/d/optout 
> .
> 
> -- 
> 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, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en 
> 
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com 
> .
> For more options, visit https://groups.google.com/d/optout 
> .

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit 

Re: Cells aka Dataflow aka FRP now pure CLJC

2016-05-25 Thread Keith Irwin
I remember you from the olden days as a colorful personality on comp.lang.lisp. 

Having spent this time with Clojure the language, and the community, any 
interesting impressions compared to Common Lisp or, well, just any general 
thoughts?

> On May 24, 2016, at 9:24 AM, hiskennyness  wrote:
> 
> Last week was supposed to be a port from a Clojure version to a CLJS version 
> but for the heck of it I did it all in CLJC and (OMG) I now have my cherished 
> little project running either way: https://github.com/kennytilton/rube
> 
> Yes, that is my third and last home for the beast.
> 
> Clojure: lein test
> Clojurescript: lein cljsbuild test
> 
> Same code, same substantial tests. Full marks to the Clojure team for making 
> it possible.
> 
> -hk
> 
> -- 
> 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, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en 
> 
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com 
> .
> For more options, visit https://groups.google.com/d/optout 
> .

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] clojure.tools.cli 0.3.2 (was: Next release for clojure.tools.cli? Is it dead?

2015-07-30 Thread Keith Irwin
Thanks!

 On Jul 28, 2015, at 3:44 PM, Sean Corfield s...@corfield.org wrote:
 
 clojure.tools.cli — tools for working with command line arguments
 
 https://github.com/clojure/tools.cli
 
 I’m pleased to announce that Sung Pae has passed the torch on to me and I 
 have released version 0.3.2 to Maven Central today. Thank you Sung for all 
 your work on tools.cli so far!
 
 This release includes all of Sung’s work to date, including TCLI-9 which 
 Keith Irwin asked about last week:
 
 • Release 0.3.2 on 2015-07-28
   • Add :no-defaults to parse-opts:
 Returns sequence of options that excludes defaulted ones.
 This helps support constructing options from multiple sources 
 (command line, config file).
   • Add get-default-options:
 Returns sequence of options that have defaults specified.
   • Support multiple validations TCLI-9
   • Support in-order arguments TCLI-5:
 :in-order processes arguments up to the first unknown option;
 A warning is displayed when unknown options are encountered.
 
 Sean Corfield -- (904) 302-SEAN
 An Architect's View -- http://corfield.org/
 
 Perfection is the enemy of the good.
 -- Gustave Flaubert, French realist novelist (1821-1880)
 
 
 
 
 On Jul 23, 2015, at 9:33 PM, Keith Irwin ke...@zentrope.com wrote:
 
 There are some handy additions committed to the tools.cli project at:
 
   https://github.com/clojure/tools.cli
 
 but there hasn’t been a release in ~1.5 years (not even a snapshot release).
 
 In fact, these commits have been sitting there for over a year.
 
 I’m especially interested in this one:
 
   http://dev.clojure.org/jira/browse/TCLI-9
 
 Any chance of a new release?
 
 -- 
 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, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Next release for clojure.tools.cli? Is it dead?

2015-07-23 Thread Keith Irwin
There are some handy additions committed to the tools.cli project at:

https://github.com/clojure/tools.cli

but there hasn’t been a release in ~1.5 years (not even a snapshot release).

In fact, these commits have been sitting there for over a year.

I’m especially interested in this one:

http://dev.clojure.org/jira/browse/TCLI-9

Any chance of a new release?


-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Accessing static fields

2015-05-20 Thread Keith Irwin
What about eval?

user =  (eval `(. ~(resolve (symbol String)) ~(symbol format) %s 
(to-array [adasd])))
“adasd

I have a function form:

(defn static-invoke
  [c meth  args]
  (eval `(. ~(resolve (symbol c)) ~(symbol meth) ~@args)))

Which works for some things:

user = (static-invoke “System” “currentTimeMillis”)
1432171781154

But the String thing was problematic:

user = (static-invoke String format a %s” (quote (to-array [foo”])))
“a foo”

(This gave a weird error until I quoted the to-array form.)

Still not helpful?


 On May 20, 2015, at 6:09 PM, Ambrose Bonnaire-Sergeant 
 abonnaireserge...@gmail.com wrote:
 
 Macros won't work because they are expanded at compile-time. We want to 
 choose the method at runtime.
 
 Thanks,
 Ambrose
 
 On Thu, May 21, 2015 at 9:02 AM, Keith Irwin ke...@zentrope.com 
 mailto:ke...@zentrope.com wrote:
 Not sure if this helps, but:
 
 user = (eval (symbol Math PI”))
 3.141592653589793
 
 user =  (eval `(. ~(resolve (symbol String)) ~(symbol format) %s 
 (to-array [adasd])))
 “adasd
 
 Maybe a macro of some sort?
 
 (defmacro invoke-static
   [c meth  args]
   `(. ~(resolve (symbol c)) ~(symbol meth) ~@args))
 
 user = (invoke-static java.lang.String format the %s (to-array 
 [foo]))
 “the foo
 
 user= (invoke-static System currentTimeMillis)
 1432170076378
 
 That kind of thing?
 
 On May 20, 2015, at 4:54 PM, Pierre Thibault pierre.thibau...@gmail.com 
 mailto:pierre.thibau...@gmail.com wrote:
 
 I gave it a try:
 
 (.. (class String) (getMethod format (into-array Class [String 
 (Class/forName [Ljava.lang.Object;)])))
 
 But I am unable to get the method. I gave up.
 
 Le mercredi 20 mai 2015 19:12:05 UTC-4, Pierre Thibault a écrit :
 Hi Laurens,
 
 My example was not very good. Here another one:
 
 (.format (first '(String)) %s foo)
 
 Imagine String is obtained dynamically. I guess then I have to use Java 
 reflection to do a dynamic invocation. I guess I am confused because classes 
 in Java are not objects.
 
 Le mercredi 20 mai 2015 18:40:13 UTC-4, Laurens Van Houtven a écrit :
 Hi Pierre,
 
 On May 20, 2015, at 3:38 PM, Pierre Thibault pierre.t...@gmail.com  
 wrote:
 
 I can do Math/PI put how can I access PI if Math is in a expression like 
 '(Math) for example?
 
 Can you provide a more specific example? Math/PI is always Math/PI, it 
 doesn’t change if you put it in a nested form/expression.
 
 hth
 lvh
 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.com 
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com 
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en 
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com .
 For more options, visit https://groups.google.com/d/optout 
 https://groups.google.com/d/optout.
 
 
 -- 
 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 
 mailto:clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com 
 mailto:clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en 
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com 
 mailto:clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout 
 https://groups.google.com/d/optout.
 
 
 -- 
 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 
 mailto:clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com 
 mailto:clojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en 
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com 
 mailto:clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout 
 https

Re: Accessing static fields

2015-05-20 Thread Keith Irwin
Not sure if this helps, but:

user = (eval (symbol Math PI”))
3.141592653589793

user =  (eval `(. ~(resolve (symbol String)) ~(symbol format) %s 
(to-array [adasd])))
“adasd

Maybe a macro of some sort?

(defmacro invoke-static
  [c meth  args]
  `(. ~(resolve (symbol c)) ~(symbol meth) ~@args))

user = (invoke-static java.lang.String format the %s (to-array [foo]))
“the foo

user= (invoke-static System currentTimeMillis)
1432170076378

That kind of thing?

 On May 20, 2015, at 4:54 PM, Pierre Thibault pierre.thibau...@gmail.com 
 wrote:
 
 I gave it a try:
 
 (.. (class String) (getMethod format (into-array Class [String 
 (Class/forName [Ljava.lang.Object;)])))
 
 But I am unable to get the method. I gave up.
 
 Le mercredi 20 mai 2015 19:12:05 UTC-4, Pierre Thibault a écrit :
 Hi Laurens,
 
 My example was not very good. Here another one:
 
 (.format (first '(String)) %s foo)
 
 Imagine String is obtained dynamically. I guess then I have to use Java 
 reflection to do a dynamic invocation. I guess I am confused because classes 
 in Java are not objects.
 
 Le mercredi 20 mai 2015 18:40:13 UTC-4, Laurens Van Houtven a écrit :
 Hi Pierre,
 
 On May 20, 2015, at 3:38 PM, Pierre Thibault pierre.t...@gmail.com  
 wrote:
 
 I can do Math/PI put how can I access PI if Math is in a expression like 
 '(Math) for example?
 
 Can you provide a more specific example? Math/PI is always Math/PI, it 
 doesn’t change if you put it in a nested form/expression.
 
 hth
 lvh
 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.com 
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com 
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en 
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com .
 For more options, visit https://groups.google.com/d/optout 
 https://groups.google.com/d/optout.
 
 
 -- 
 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, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en 
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com 
 mailto:clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout 
 https://groups.google.com/d/optout.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: java.jdbc DSLs (java.jdbc.sql / java.jdbc.ddl)

2013-11-23 Thread Keith Irwin
Sean—

Personally, the DSL doesn’t bother me at all. (Just a data point.) I get where 
you’re going with it, and support the idea, FWIW, but if it were gone, I 
wouldn’t notice. My needs are 1) so simple, strings work, or 2) so complicated, 
a (or any) DSL is just extra headache. (Reading them out of a separately 
maintained data file, for instance, is one way to go.)

BUT:

The mixture of the old API and the new API is problematic, mainly because it’s 
difficult for me (anyway) to look down the list of functions and figure out 
which are old and which are new.

I understand the need to maintain the old API, and I’m not arguing against that 
at all.

Might you be able to publish a parallel version of the API *documentation* with 
all the deprecated stuff removed for those folks new to the library who are 
uninterested in the old API? Even users of the old API might appreciate it for 
the same reasons.

Parallel (and conjoined) API docs would solve ALL my (admittedly shallow) 
problems, actually, but I wonder if it would remove some confusion for others 
new to the lib and Clojure?

On Nov 20, 2013, at 2:25 PM, Sean Corfield seancorfi...@gmail.com wrote:

 Thank you both - that's excellent feedback!
 
 I certainly don't want the library to cause confusion so maybe
 hiding/removing the DSLs would be the best path going forward.
 
 Right now, a handful of the DSL functions are used to generate the SQL
 behind delete!, insert! and update! as well as the core implementation
 of the naming strategy stuff. We're also using a few of them in
 production code at World Singles but it would be easy enough to back
 off that and switch to HoneySQL (which we use extensively elsewhere).
 
 I totally agree about the API being too broad. I'd like to just drop
 the old API completely but experience with APIs changing in contrib
 libraries has shown that backward compatibility needs to be maintained
 for at least a version or two so folks can migrate off the old API. I
 was planning to streamline the API - dropping the old API that relied
 on the dynamic *db* variable - in 0.5.0 but maybe I'll make that the
 focus of 0.4.0 instead.
 
 The feedback on the DSLs - ever since my first proposal to add them -
 seems to be overwhelmingly negative so at this point I'm now
 considering removing them from 0.3.0 rather than perpetuate the
 confusion.
 
 Is anyone using the java.jdbc.sql namespace? (besides World Singles :)
 
 Sean
 
 
 
 On Wed, Nov 20, 2013 at 3:52 AM, Alice dofflt...@gmail.com wrote:
 I agree with Colin and had a similar experience.
 
 Even if you say it's completely optional, people will first try it because
 it's already included. I think honeysql is good and also not any harder to
 use than the included DSL. It's concept is very simple and clear. Actually,
 your DSL is magical because it's based on macro.
 
 For example, I asked about specifying the default name mapping functions
 before* and it was not the first time. I had to see the source code to
 understand why it's not possible. I was only the second but I bet you'll
 keep hearing this kind of questions over and over again. If you keep the
 jdbc and DSL in the same library, it becomes confusing to users why some
 things are not possible.
 
 And I don't see any problem with separating it into another library. It's
 just one additional line in project.clj.
 
 *
 https://groups.google.com/forum/#!searchin/clojure/jdbc/clojure/iOBs_VC09FM/8aUF2xzz7scJ
 
 
 On Wednesday, November 20, 2013 6:41:33 PM UTC+9, Colin Yates wrote:
 
 Hi Sean,
 
 First - I hugely appreciate the work you have done and use java.jdbc
 daily.
 
 However, as a complete newbie I found the included DSL very unhelpful.
 The java.jdbc API is very wide and navigating it was hard,  Particularly as
 it was in a transition from using bound *db* to not, so effectively there
 seemed two APIs.
 
 I started using the DSL and it didn't meet the expectation I think anybody
 would have for a DSL in that it wasn't complete or expressive enough.  There
 were moments where the combined experience was very very negative and not
 representative of the quality of the work you have put in.
 
 It also made it unclear what the library was supposed to do (regardless of
 what the documentation says :)).
 
 Treating java.jdbc without the DSL and the DSL as separate projects (I
 realise they are separate namespaces already) would be a much stronger
 statement of intent I think.
 
 To put it another way, at the moment the risk is to interpret java.jdbc as
 a DSL on top of JDBC with some low level utilities around managing
 connections.  That clearly isn't true and the project comes off looking very
 poor.
 
 Please hear me - I write this only because I think my experience will be
 very similar to a lot of other people's experiences when they start adopting
 the library whilst picking up Clojure at the same time!
 
 For me, the combination of honeysql and java.jdbc is close to perfect, but
 my point again is that I came 

Re: Weird core.async/ClojureScript not workings...

2013-09-17 Thread Keith Irwin
I'm having the same issue.

Here's a project with a timeout loop demonstrating the problem:

   https://github.com/zentrope/clock

Using core.async SNAPSHOT and any clojurescript release after 1859 seems to 
break along the same lines as the OP.

Other elements I have going:

 - cljsbuild 0.3.3
 - prismatic 0.1.2

but they don't seem to cause issues with 1859. If you've got any tips on using 
core.async master (maybe using lein's checkout feature?) I wouldn't mind trying 
that.

On Sep 16, 2013, at 3:32 PM, David Nolen dnolen.li...@gmail.com wrote:

 Which versions of ClojureScript and core.async are you using?
 
 David
 
 
 On Mon, Sep 16, 2013 at 5:25 PM, David Pollak feeder.of.the.be...@gmail.com 
 wrote:
 Howdy,
 
 I'm using core.async and ClojureScript and it seems that inside a go block, 
 if/when/loop/while code is never executed.
 
 For example:
 
   (def dog33 (go (if true (.log js/console it's true) (.log js/console 
 it's false
 
 prints neither it's true nor it's false, but 
 
   (def dog33 (go (do (.log js/console it's true) (.log js/console it's 
 false
 
 prints both.
 
 I'm doing lein cljsbuild auto to generate the JavaScript.
 
 Any pointers would be appreciated.
 
 Thanks,
 
 David
 
 -- 
 Brick Alloy http://brickalloy.
 Lift, the simply functional web framework http://liftweb.net
 Follow me: http://twitter.com/dpp
 Blog: http://goodstuff.im
 
 
 -- 
 -- 
 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, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.
 
 
 -- 
 -- 
 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, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: clojure.java.jdbc, idiomatic way to use a connection

2013-08-14 Thread Keith Irwin
I think you can use db-connection, something like:

  (let [conn (db-connection spec)
 meta (.getMetaData conn)]
(doall (.getTables meta nil schema %s nil))
(.close conn))

Or what have you. I wrote a little macro `with-meta-data` that was something 
like that, with added try/catch/finally to make sure the conn got closed. 

Is `with-open` a possibility?

  (with-open [conn (db-connection spec)]
 …)

Would that work?

On Aug 14, 2013, at 8:02 PM, Kyle Cordes kyle.cor...@gmail.com wrote:

 Hello. I've coded quite a lot of JDBC usage in Java, and enough Clojure to 
 know my way around pretty well; yet I've been unable to figure out the 
 following by reading the source and docs for clojure.java.jdbc. I've read 
 http://clojure.github.io/java.jdbc/ and many pages linked from there.
 
 The question is:
 
 How do I get a connection, then run a series of operations on that same 
 connection? All the API I can find (except for the deprecated, pre-0.3 API) 
 seems to work on a model of: give it a DB connection spec, it connects, runs, 
 and disconnects. Great for playing with a command at a time, less so for 
 doing a series of things that need to happen on the same connection.
 
 -- 
 Kyle Cordes
 http://kylecordes.com
 
 
 -- 
 -- 
 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, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Interest in a Full Featured Clojure Blog Engine

2013-07-21 Thread Keith Irwin
On Jul 21, 2013, at 10:01 PM, Colin Fleming colin.mailingl...@gmail.com wrote:

 I'm a fan of static generators too, but one large con for a lot of people is 
 lack of commenting. Personally I like the article-with-no-comments format, 
 but it's not for everyone. You can use Disqus or similar, but it has its own 
 issues starting with the fact that you give all your data to someone else. 
 More pros for static generators are that you can use whichever editor you 
 want and you get version control easily too.

A static-site generator, Clojure-style (which I think ends up being Leiningen 
style), would be a great value add over the well-trodden dynamic-website world.

An extra cool thing would be a great local web-app that you run yourself that 
lets you interact with the config files and markdown content (or whatever). 
Gives you ease-of-use, but allows you to NOT use it if you're into Emacs, 
hand-editing hiccup templates (say) and a Leinigen-like site.clj file.

I could imagine such an app being generalized to handle numerous sites for 
those folks who might want to create a blogging github kind of thing.

K

 
 
 On 22 July 2013 10:33, Steven Degutis sbdegu...@gmail.com wrote:
 The more I think about the static blog generator idea, the more I think it's 
 different enough to be a separate project.
 
 But anyway, I already wrote this list of pros/cons to why I think static blog 
 generators are better, so might as well post it:
 
 Pros:
 Runs anywhere you can host HTML, such as Github Pages (which is free btw)
 No need for authentication/authorization code
 No need for WYSWYG editor
 No need for server component
 No need for a database
 No need for an admin console (probably replaced by config files)
 Import/export is probably easier, since blog entries are just files
 Cons:
 Can't make middleware plugins (but I can't think of a need for one)
 Probably would need ugly/tedious user-editable config files
 Can't remember the last one, but (or thus?) it probably wasn't important
 -Steven
 
 
 On Sun, Jul 21, 2013 at 5:23 PM, Steven Degutis sbdegu...@gmail.com wrote:
 Lately, a lot of people are moving away from dynamic blog engines like 
 Wordpress, and starting to use static blog generators like Jekyll.
 
 You may want to consider this route instead. I'm sure a plugin system would 
 still be relevant and useful for a static blog generator.
 
 -Steven
 
 
 On Thu, Jul 18, 2013 at 9:24 AM, Timothy Washington twash...@gmail.com 
 wrote:
 Hello, 
 
 I'm thinking of how to build a composable blogging engine in Clojure. There 
 have been a few attempts at this, with cow-blog and my-blog. But these seem 
 to be abandoned, and not heavily used. Vijay Kiran, last year, even wrote a 
 series of blog posts (see here) about building a blog engine. As far as a 
 list of posts goes, the data structure for each record was simple: 
 title
 content
 status
 created-date
 published-date
 author 
 
 I think this is the most basic thing you could do, to get running. But I'm 
 thinking of approaching the feature set of Wordpress. So I'm thinking of the 
 Data Structure(s) of features like: 
 Web UI component; wyswyg editor, themes  
 Server component; embeddable in Compojure or Pedestal 
 Database component; 
 raw data structures, txt, rtf, images, audio, videos, documents
 adapters for Datomic, SQL(Postgres, etc), NoSQL (Mongo, etc)
 tags / categories for content 
 Authentication  Authorization; OpenID 
 Workflow component; preview, collaboration  editor review 
 Commenting component; default or an external comments service, like disqus or 
 discourse
 Administration Console
 Plug-in support 
 Import / Export 
 Multi-lang / Internationalization 
 
 I know that I currently wish I had a Clojure weblog engine that I could stick 
 into a site I'm building. If there's already something available, I'll 
 obviously just use that. But otherwise, is this something that would be 
 interesting to people? 
 
 
 Thanks 
 
 Tim Washington 
 Interruptsoftware.ca / Bkeeping.com 
 416.843.9060 
 
 
 -- 
 -- 
 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, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  
 
 
 
 -- 
 -- 
 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 

Re: seancorfield /clj-soap

2013-05-18 Thread Keith Irwin
On May 18, 2013, at 5:32 PM, Marc Boschma marc.bosc...@gmail.com wrote:

 Well understood Sean!
 
 If I work out away to up lift the code I'll contribute that back. 
 
 I was just checking to see if anyone else had tried.
 
 If, like you, I need to find another way is Axis 1.x an easier platform than 
 2.x ?The Java SOAP landscape seems overly complex.
 
 Marc
 
 I really wish the service I need to integrate with was REST based…

You know, I was faced with this once. What we ended up doing (in Groovy) was 
just crafting our own SOAP envelope template so to speak, and injecting the 
specifics for the actual SOAP request into it, then using a plain HTTP request. 
I imagine using something like hiccup would make it even more fun. Add in xml 
zippers to extract out the good bits from the WSDL, and there you go. 

Kind of a hack, but it was much easier to maintain and fix over time than 
attempting to generate classes via WSDL. Even hand inspecting the WSDL was 
better than the alternatives

;)

Keith

 
 On 19/05/2013, at 12:43 AM, Sean Corfield seancorfi...@gmail.com wrote:
 
 Since my name was invoked via mention of this repo, I figured it was a
 good chance to post from the readme:
 
 Note however that I am not actively maintaining this library and
 would welcome someone taking it over. I updated Tetsuya's code to use
 a more modern Clojure environment purely to test it for a problem I
 was working on - it didn't really do what I needed so I took a
 different approach (using Axis 1.x libraries at a much lower level for
 one specific web service).
 
 Sean
 
 On Fri, May 17, 2013 at 11:29 PM, marc marc.bosc...@gmail.com wrote:
 Hoping someone has already explored this. Has anyone ever used clj-soap as a
 client and managed to pass in Basic authentication credentials?
 
 I tried putting them into the URL to the WSDL but that did seem to work…
 
 Off to read up on Axis 2…
 
 
 
 --
 --
 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, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.
 
 
 
 --
 Sean A Corfield -- (904) 302-SEAN
 An Architect's View -- http://corfield.org/
 World Singles, LLC. -- http://worldsingles.com/
 
 Perfection is the enemy of the good.
 -- Gustave Flaubert, French realist novelist (1821-1880)
 
 -- 
 -- 
 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, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.
 
 
 
 -- 
 -- 
 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, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.
 
 

-- 
-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



Re: [ANN] swank-clojure 1.3.4 released

2011-12-28 Thread Keith Irwin
Hi--

The only way I could get the colorized stack-trace was to use M-x 
clojure-jack-in.

Normally, I type lein swank on a command line, then use M-x slime-connect 
from Emacs. This is so that I can see the clojure.tools.logging output. 
(I've no idea where it goes when you use clojure-jack-in.

I'm also using emacs 24 and clojure-mode 1.11.5.


-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

clojure libs and logging

2011-11-22 Thread Keith Irwin
Folks--

I'm working on an experimental library which interfaces with external 
resources (i.e., not purely functional) and I'd like the library to log 
things when stuff goes wrong (say, with network connections). I don't want 
to throw exceptions and let clients handle it because I want to build in 
some automated reconnect stuff.

Normally, I use clojure.tools.logging and add dependencies for log back. 
Works great.

What's the standard way for including logging in a library? I've included 
clojure.tools.logging as a dependency, but the resulting jar (lein 
install), contains clojure.tools.logging classes. Is that okay, given any 
project its likely to be included in will also depend on 
clojure.tools.logging?

Is there some way to do this? Is embedded logging (like Jetty has, for 
instance), just Not Done in the clojure library world?

Keith

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: clojure libs and logging

2011-11-22 Thread Keith Irwin
I'm guessing that removing the non-project classes and then just declaring 
a dependency should work well enough.

Couldn't find :disable-implicit-clean in the sample project file 
technomancy maintains on his github repo, but did use 
:clean-non-project-classes, which removed the compiled logging classes from 
the jar file but kept my own.

However, I inspected a few of the jars in my ~/.m2 directory for other 
projects and realized people ship libraries as pure clj source files. Neat!

The only way I could get this to work was to remove the :main setting from 
project.clj. After doing that, lein install and lein jar just include 
the source, which is good enough for me (and results in a much smaller jar 
file).

To run my small long/running main test/dev code, I can use :run-alias.

Then,

   lein trampoline run :main

does the trick. (I use trampoline so that shutdown hooks get properly 
invoked).

Thanks!

K

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Another newbie question

2011-11-07 Thread Keith Irwin
I'm new to all this, too. The kinds of teams I've worked on, generally, 
favor breaking down a problem into separate processes such that we each get 
to work on our own apps which communicate via messaging or http, so I may 
not have quite the experience you have with big shared-code libraries 
(other than jar files downloaded from the net).

What I've been moving towards, slowly, is the idea of not caring too much 
about what the actual thing is that gets passed around from function to 
function, but instead just caring about the functions themselves and the 
end-result values.

For instance, say you want an S3 client, you might do something like:

(let [client (s3/mk-client)]
  (when (exists? client bucket-name)
  (post client my-data)
  (println (s3-get client my-key)))

(Please excuse the poor naming.)

The client is actually a map with connection info and other metadata, but 
I just don't have to care as a user of the S3 namespace. All I really need 
to know is what's public in the s3-client name space.

Admittedly, this is really a sort-of OO kind of thing (in which I'm doing 
method object params rather than object.method(params)) but it really does 
seem clear when I come back to it later.

I've seen other similar usages, such as the various web frameworks, and 
even the congo-mongo driver. The connection object in congo-mongo is a map 
with some java-driver objects in it, but you don't ever really have to know 
that. Just (with-conn conn (collection :data)) or similar.

The web apps do similar things with the server you start up:

(let [server (mk-jetty-server :port 8080 :mode async :foo bar)]
  (jetty server start))

But maybe you're talking about value objects?

I guess the bottom line is that I feel for you question because I've spend 
SO LONG in the OO world that I've lost the sense of encapsulation as 
something separate from classes.

K

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Another newbie question

2011-11-07 Thread Keith Irwin
Oops. I somehow it some magic key. Soon as that post makes it through 
review I'll rewrite it to something short and useful. Moral of the story 
is to not use the web form on Google Groups.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Matt Raible: Why is Clojure better than Scala or Groovy?

2010-01-17 Thread Keith Irwin
I don't think you can really answer the question because it being asked in
the way it that precludes a good enough answer. The tone of Matt Raible's
request suggests that he'd really rather not learn it, and that there's no
possible reason to overcome that reluctance.

Why travel? There's plenty of good food right here, and interesting cultural
sites to see, and stuff to buy. But you don't ask that question: you just
go, and FIND OUT why it was worth doing after the fact. (Or maybe not.)

Still. My take:

1. Clojure is dynamic like Groovy, and functional like Scala, so if Matt
learned it, he'd be able to see what that's like.

2. It's a Lisp, and that's worth trying at least once, but it's on the JVM
and a new dialect, so it lets you write Java in Lisp at first, and the lets
you enjoy beginning to see new ways of thinking about problems.

3. Clojure has a flavor of STM that's database-like, and easy to use for the
non-theorist programmer (i.e., folks like me who just write dorky business
apps that aren't much more than shoving data to/from the web/database). This
really cuts down on threading bugs, which are super hard to diagnose when
the errors occur in production, which is always locked down and inaccessible
to devs, debuggers, etc. STM doesn't help distributed concurrency (for which
actors are better, imho), but it does help for a wide range of
non-distributed use cases.

4. Clojure's macros make domain specific languages a natural part of
programming. While Groovy's various Builders are pretty nice, it's not so
easy to write your own builder, esp. if you're under pressure to get
something done. For instance, I write a lot of Groovy apps, and I want
something like Compojure. But the idea of figuring out how to use the
Builder Support to do something like that just makes me tired.

Really, though, it's so hard to convince someone that one language is better
than another significantly enough to be worth learning using reason or
any other method. One just has to try it.

For me, Clojure/Lisp just works the way I do. Incremental, small functions,
interactive, etc, etc generally as a result of super-vague requirements.
Every time I write an app in it, I feel like the app gets smaller and
simpler over time. I let myself write a lot of boilerplate (to avoid
premature abstraction), then condense it all in a way that fits my app (not,
say, a general lib), and the whole experience of it is positive. Better,
smaller code, faster, and more fun to do (even if it's the same old business
tasks).

So, Clojure wins or is worth trying because of the experience of using
it, not because of some particular bullet point, which all languages feel
like they all have.

(Personally, I'd really love Haskell/Erlang like pattern matching, not just
destructuring or multi-methods (but those, too!), but even so)

Didn't Paul Graham say something to the affect that a user of a blub
language just can't see the point in other languages? I don't think Groovy
and Scala are blub languages, but I think the idea applies, at least in an
emotional way.

Matt should just give it a few weeks' try, like Tim Bray did.

Keith

On Sun, Jan 17, 2010 at 12:00 PM, Mike Meyer 
mwm-keyword-googlegroups.620...@mired.org wrote:

 On Fri, Jan 15, 2010 at 8:22 PM, Julian juliangam...@gmail.com wrote:
  Matt Raible - Spring Expert and Java consultant posted the following
  entry to Twitter:
  Why is Clojure better than Scala or Groovy?

 How about two reasons to learn Clojure instead?

 1) Clojure is (a) LISP. According to Eric Raymond, LISP is worth
 learning for a different reason — the profound enlightenment
 experience you will have when you finally get it. That experience will
 make you a better programmer for the rest of your days, even if you
 never actually use LISP itself a lot.

 2) Clojure is designed from the ground up for concurrent
 programming. It has a number of mechanisms that improve on locks for
 managing state. Those come from other languages, and are liable to
 appear in yet more languages in the future. If you're doing concurrent
 programming, learning them will make you a better concurrent
 programmer. If you're not doing concurrent programming, consider that
 CPU improvement has changed from an exponential growth in raw speed to
 an exponential growth in number of cores.

   mike
 --
 Mike Meyer m...@mired.org
 http://www.mired.org/consulting.html
 Independent Network/Unix/Perforce consultant, email for more information.

 O ascii ribbon campaign - stop html mail - www.asciiribbon.org

 --
 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, send email to
 clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 

Re: AbstractMethodError question

2009-12-12 Thread Keith Irwin
I figured out the problem and thought I'd note it here.

When you proxy and object, the proxy code calls the constructor of
the object BEFORE it registers its own methods as overrides for the
object's methods.  If the constructor calls methods, they'll be its
own implementations rather those of the proxy.

Bottom line, if the object you're proxying does a lot of work in its
constructor using methods in its class, the proxy's methods won't be
called. If one of those methods is abstract, you're screwed.

The code I'm working with, though, does this all over the place.

I ended up having to write some Java that wrapped an inner subclass of
the offending class, and used Clojure to implement an interface which
the inner class can use.

Keith

On Fri, Dec 11, 2009 at 4:18 PM, Keith Irwin keith.ir...@gmail.com wrote:


 On Dec 11, 3:31 pm, ataggart alex.tagg...@gmail.com wrote:
 On Dec 11, 12:27 pm, Keith Irwin keith.ir...@gmail.com wrote:

  Folks--

  I've got a class I can't change which has an abstract method I'd like
  to override using the proxy macro in Clojure.

  The class looks something like:

  public abstract class Foo {

     private Map stuff;

     private void initStuff() {

         stuff = new HashMap();
         stuff.put(a, new Object());
         addStuff(stuff);
     }

     protected void abstract addStuff(Map stuff);
   }

  Normally, you extend the above and implement the addStuff method.
  Works in Groovy as long as I explicitly state the void return type and
  the type of the parameters.

  In Clojure, I construct:

     (proxy [Foo] []
        (addStuff [stuff] (println yay!)))

  But get an AbstractMethodError when I attempt to use the Foo class
  (calling a method which eventually calls addStuff).

  The docs suggest I can override a protected method class, but can't
  call other protected methods, which I think is fine, here.

  Is there something I'm missing?

  Keith

 Given what you have written, the proxy function will return an
 instance that extends Foo, implementing the addStuff method; it
 doesn't modify the Foo class, nor provide you with a derived class.
 If you want to create a derived class that's accessible from java,
 you'll need to use something related to gen-class.

 I was under the impression that :gen-class only works for AOT
 compilation, rather than running in a scripting context. Maybe the
 solution is to add a little Java to the mix. The unfortunate part of
 all this is that I HAVE to use the something like the above class due
 to Politics.

 Thanks!

 Keith

 --
 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, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


AbstractMethodError question

2009-12-11 Thread Keith Irwin
Folks--

I've got a class I can't change which has an abstract method I'd like
to override using the proxy macro in Clojure.

The class looks something like:

public abstract class Foo {

   private Map stuff;

   private void initStuff() {

       stuff = new HashMap();
       stuff.put(a, new Object());
       addStuff(stuff);
   }

   protected void abstract addStuff(Map stuff);
 }

Normally, you extend the above and implement the addStuff method.
Works in Groovy as long as I explicitly state the void return type and
the type of the parameters.

In Clojure, I construct:

   (proxy [Foo] []
      (addStuff [stuff] (println yay!)))

But get an AbstractMethodError when I attempt to use the Foo class
(calling a method which eventually calls addStuff).

The docs suggest I can override a protected method class, but can't
call other protected methods, which I think is fine, here.

Is there something I'm missing?

Keith

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: AbstractMethodError question

2009-12-11 Thread Keith Irwin
On Fri, Dec 11, 2009 at 12:27 PM, Keith Irwin keith.ir...@gmail.com wrote:

 public abstract class Foo {

    private Map stuff;

    private void initStuff() {

        stuff = new HashMap();
        stuff.put(a, new Object());
        addStuff(stuff);
    }

    protected void abstract addStuff(Map stuff);
  }

 In Clojure, I construct:

    (proxy [Foo] []
       (addStuff [stuff] (println yay!)))


I should amend this to say that I get an AbstractMethodError when the
(proxy ...) is evaluted. I'm running the code as a script.

Keith

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: AbstractMethodError question

2009-12-11 Thread Keith Irwin


On Dec 11, 3:33 pm, ataggart alex.tagg...@gmail.com wrote:
 On Dec 11, 12:44 pm, Keith Irwin keith.ir...@gmail.com wrote:





  On Fri, Dec 11, 2009 at 12:27 PM, Keith Irwin keith.ir...@gmail.com wrote:
   public abstract class Foo {

      private Map stuff;

      private void initStuff() {

          stuff = new HashMap();
          stuff.put(a, new Object());
          addStuff(stuff);
      }

      protected void abstract addStuff(Map stuff);
    }
   In Clojure, I construct:

      (proxy [Foo] []
         (addStuff [stuff] (println yay!)))

  I should amend this to say that I get an AbstractMethodError when the
  (proxy ...) is evaluted. I'm running the code as a script.

  Keith

 Hmm, this works fine for me:

 user= (def mymap (proxy [java.util.AbstractMap] [] (entrySet []
 (println yay!
 #'user/mymap
 user= (.entrySet mymap)
 yay!
 nil

The case I have is that a method in the abstract class is calling the
abstract method, and my proxy object doesn't seem to, uh, proxy that
method at all. So, in your example, there's have to be some other
method in AbstractMap that called entrySet. If that worked, then I'd
really be wondering what's going on.

Argh! ;)

Keith

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: AbstractMethodError question

2009-12-11 Thread Keith Irwin


On Dec 11, 3:31 pm, ataggart alex.tagg...@gmail.com wrote:
 On Dec 11, 12:27 pm, Keith Irwin keith.ir...@gmail.com wrote:

  Folks--

  I've got a class I can't change which has an abstract method I'd like
  to override using the proxy macro in Clojure.

  The class looks something like:

  public abstract class Foo {

     private Map stuff;

     private void initStuff() {

         stuff = new HashMap();
         stuff.put(a, new Object());
         addStuff(stuff);
     }

     protected void abstract addStuff(Map stuff);
   }

  Normally, you extend the above and implement the addStuff method.
  Works in Groovy as long as I explicitly state the void return type and
  the type of the parameters.

  In Clojure, I construct:

     (proxy [Foo] []
        (addStuff [stuff] (println yay!)))

  But get an AbstractMethodError when I attempt to use the Foo class
  (calling a method which eventually calls addStuff).

  The docs suggest I can override a protected method class, but can't
  call other protected methods, which I think is fine, here.

  Is there something I'm missing?

  Keith

 Given what you have written, the proxy function will return an
 instance that extends Foo, implementing the addStuff method; it
 doesn't modify the Foo class, nor provide you with a derived class.
 If you want to create a derived class that's accessible from java,
 you'll need to use something related to gen-class.

I was under the impression that :gen-class only works for AOT
compilation, rather than running in a scripting context. Maybe the
solution is to add a little Java to the mix. The unfortunate part of
all this is that I HAVE to use the something like the above class due
to Politics.

Thanks!

Keith

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en