Re: How to migrate definitions to another namespace ?

2009-08-28 Thread Laurent PETIT
Could some kind of :force true flag be generally interesting for the def
special form ? (:force true would force an unmap first, if necessary)

2009/8/29 Vagif Verdi 

>
> Thx to all. ns-unmap and remove-ns are what i need.
>
> From my CL experience i was looking for something like unitern.
> >
>

--~--~-~--~~~---~--~~
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: How to migrate definitions to another namespace ?

2009-08-28 Thread Vagif Verdi

Thx to all. ns-unmap and remove-ns are what i need.

>From my CL experience i was looking for something like unitern.
--~--~-~--~~~---~--~~
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: How to migrate definitions to another namespace ?

2009-08-28 Thread Mike Hinchey
I use (remove-ns 'my-ns), then reload the entire file.

-Mike

--~--~-~--~~~---~--~~
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: How to migrate definitions to another namespace ?

2009-08-28 Thread Timothy Pratley

How about something like this?

user=> (ns fun)
fun=> (defn myfun [] 1)
fun=> (defn myfun2 [] 1)
fun=> (keys (ns-publics 'fun))
(myfun myfun2)

fun=> (doseq [s (keys (ns-publics 'fun))] (ns-unmap 'fun s))
fun=> (myfun)
java.lang.Exception: Unable to resolve symbol: myfun in this context
(NO_SOURCE_FILE:19)


On Aug 29, 1:55 pm, Vagif Verdi  wrote:
> I often refactor my code and move some functions to new modules.
> Unfortunately i cannot load them, because clojure says that function
> with such name is already loaded from another namespace. I could not
> find nothing better but to close my clojure session (which means bring
> down the web server) and start it back again.
>
> Is there a way to unregister some names from a namespace without
> reloading it ?
--~--~-~--~~~---~--~~
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: How to migrate definitions to another namespace ?

2009-08-28 Thread J. McConnell

On Aug 28, 2009, at 11:55 PM, Vagif Verdi  wrote:
>
> I often refactor my code and move some functions to new modules.
> Unfortunately i cannot load them, because clojure says that function
> with such name is already loaded from another namespace. I could not
> find nothing better but to close my clojure session (which means bring
> down the web server) and start it back again.
>
> Is there a way to unregister some names from a namespace without
> reloading it ?

Check out ns-unmap, I think that should do want you want. Contrib's ns- 
utils might have some related functions too, but I'm not near a  
computer to check.

HTH,

- J.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



How to migrate definitions to another namespace ?

2009-08-28 Thread Vagif Verdi

I often refactor my code and move some functions to new modules.
Unfortunately i cannot load them, because clojure says that function
with such name is already loaded from another namespace. I could not
find nothing better but to close my clojure session (which means bring
down the web server) and start it back again.

Is there a way to unregister some names from a namespace without
reloading it ?

--~--~-~--~~~---~--~~
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: Order of keys within a map?

2009-08-28 Thread Travis

Is the number 8 just a magic number? Can it be changed with an
environment variable or system variable or binding? I would definitely
like to.

I am particularly annoyed by how the function into changes my array
maps into hash maps when they grow. The type of the first argument is
an array map, so the type of the return value should be also.

,(class (into (array-map :a 1) (array-map :b 2 :c 3 :d 4 :e 5 :f 6 :g
7 :h 8 :i 9)))

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Significant isa? / multimethod optimization opportunity

2009-08-28 Thread Chas Emerick

In the course of doing some profiling tonight, I hit on a hotspot in  
some particularly multimethod- and isa?-heavy code.  It didn't take me  
long to find that the bases and supers support fns for isa? were at  
the root of the issue, with bases in particular taking more time in  
aggregate than the bodies of the multimethods themselves.

A quick fix for this was to memoize bases and supers.  Given that  
these fns are concerned only with Classes (and not the dynamic  
hierarchies, etc), this would seem to be safe in general.  The  
benefits are compelling (times given for a single invocation of a  
particular lazily-recursive multimethod):

Baseline, no memoization: 17165ms
After memoizing supers: 2874ms
After memoizing supers & bases: 2749ms

That's a big factor difference, and in aggregate, the impact would be  
quite huge.

Memoizing bases is strictly redundant w.r.t. optimizing the use of  
isa?, as isa? only calls supers.  However, assuming the safety of this  
approach, there's no harm in memoizing bases as well for those fns  
that do use it (like parents).

I'd presume that a memoization that uses a WeakHashMap in the  
background would be far preferable to the built-in memoize fn in core  
now -- this would allow unloaded Classes to be dropped from the cache  
appropriately.  Further, Class doesn't override hashCode or equals  
itself, so memoizing these fns should allow for multiple instances of  
the same Class (e.g. from different classloaders) to peacefully coexist.

Given that, it seems to me that this approach is safe, at least with  
what I know about module systems, and the other factors associated  
with classloading, etc.  There's the wildcard of what's going on in  
the JDK 7 future, but I can't usefully talk about that.

Thoughts?  If this is deemed safe and acceptable, I'd be very happy to  
produce a ticket + patch.

- Chas

--~--~-~--~~~---~--~~
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/EPL and the GPL

2009-08-28 Thread Daniel Renfer

perhaps this link in the FAQ for the EPL will clear things up.

http://www.eclipse.org/legal/eplfaq.php#USEINANOTHER

On Fri, Aug 28, 2009 at 1:11 PM, Tassilo Horn wrote:
>
> Matthias Benkard  writes:
>
> Hi Matthias,
>
>> On 28 Aug., 13:42, Tassilo Horn  wrote:
>>> I have a licensing question. Am I allowed to include clojure.jar in a
>>> GPL project?
>>
>> IANAL, but if I understand the GPL correctly, it prohibits you from
>> distributing a GPL-covered programme that is based on Clojure, because
>> it would need to be linked to the EPL'd Clojure library code and so
>> would make the combination have to be distributed under the GPL, which
>> is impossible.
>
> Yes, that's my impression, too.  Does it make a difference not to
> distribute the clojure.jar with the GPL project, but to add "you have to
> dowload clojure.jar and place it in the lib/ dir" to the README?
>
>> What you can do to improve the situation in this case is to add an
>> exception to the license.  See
>> http://www.gnu.org/licenses/old-licenses/gpl-2.0-faq.html#GPLIncompatibleLibs
>> for details.
>
> That looks practical.
>
>> If you don't own all of the GPL'd code, I think you're out of luck,
>> though.
>
> Well, the exception would only to be added to the code that requires
> clojure.  IMHO, this is only the code written in clojure itself, and
> that would all be written from scratch.  So here the copyright holders
> are available.
>
> Bye,
> Tassilo
>
> >
>

--~--~-~--~~~---~--~~
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: with-open should use a close multimethod?

2009-08-28 Thread Jarkko Oranen

> I'll submit a patch if it's wanted.  This would fit in core, or maybe
> contrib.duck-streams with a slightly different name.

This should be in core I think, so that it can work with with-open—
unless we're going to duplicate with-open in contrib. :/

--
Jarkko
--~--~-~--~~~---~--~~
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/EPL and the GPL

2009-08-28 Thread Tassilo Horn

Matthias Benkard  writes:

Hi Matthias,

> On 28 Aug., 13:42, Tassilo Horn  wrote:
>> I have a licensing question. Am I allowed to include clojure.jar in a
>> GPL project?
>
> IANAL, but if I understand the GPL correctly, it prohibits you from
> distributing a GPL-covered programme that is based on Clojure, because
> it would need to be linked to the EPL'd Clojure library code and so
> would make the combination have to be distributed under the GPL, which
> is impossible.

Yes, that's my impression, too.  Does it make a difference not to
distribute the clojure.jar with the GPL project, but to add "you have to
dowload clojure.jar and place it in the lib/ dir" to the README?

> What you can do to improve the situation in this case is to add an
> exception to the license.  See
> http://www.gnu.org/licenses/old-licenses/gpl-2.0-faq.html#GPLIncompatibleLibs
> for details.

That looks practical.

> If you don't own all of the GPL'd code, I think you're out of luck,
> though.

Well, the exception would only to be added to the code that requires
clojure.  IMHO, this is only the code written in clojure itself, and
that would all be written from scratch.  So here the copyright holders
are available.

Bye,
Tassilo

--~--~-~--~~~---~--~~
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: Why doesn't regex implement ifn?

2009-08-28 Thread Chas Emerick

On Aug 28, 2009, at 12:13 PM, Chouser wrote:

> On Fri, Aug 28, 2009 at 10:01 AM, Shawn  
> Hoover wrote:
>>
>> However, unless the platforms agree on literal regex
>> syntax (they don't, beyond the basic "asdf|[0-9]+"
>> features) will prevent true portability of the literals.
>
> This is an interesting and crucial assertion.  If the regex
> syntaxes do not have a useful overlap, only libraries that
> allow regexs to "pass through" from the app to the platform
> (creating no new regex objects of their own) will be
> portable, at which point wrapping the pattern in
> a clojure-something becomes rather less useful (except
> I suppose for the original IFn point).
>
> But is it true?  The amount of overlap between, for example,
> JVM and JavaScript is quite substantial, both having
> borrowed features and syntax quite heavily from perl.
>
> http://www.regular-expressions.info/refflavors.html
>
> I think that a s long as we're not trying to support ancient
> engines (such as sed, awk, emacs...) the subset that
> overlaps would be quite useful.

Any kind of substantial difference in the implementation (and not just  
in the supported feature set) will lead to lots of confusion when  
those differences become apparent.  The key thing is that what's  
substantial to one is unimportant to another.

e.g.: A quick scan of that page shows two really big differences  
between .NET and Java -- only the latter has possessive quantifiers  
(which I've come to love for certain tight jams), and only the former  
has named groups (a feature I dearly miss from my python days when in  
the Java world).  I don't think we do anyone any favors trying to come  
up with a supported regex variant that is only the intersection of the  
host platforms that are of interest (which, of course, will change).

I guess I'm just missing the boat on the motivation here.  Will the  
same principle apply for networking and graphics and concurrency,  
too?  I can't imagine so...

- Chas

--~--~-~--~~~---~--~~
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: clj-apache-http not being found in classpath?

2009-08-28 Thread Dan McGrady
Your right, clj-apache-http.jar didn't build properly.
It only contained a manifest.

When I do "ant" in the /clj-apache-http/ folder I get this (terminal
output):

http://gist.github.com/177087

I'll try to figure out how to build it properly later today, I'm coming from
Ruby so I'm not familiar with building/compiling jars :)

The path to the 4 jars you mentioned were in a .clojure in the folder, does
that add it to the CP?


Dan McGrady
http://dmix.ca | 647-966-7986


On Fri, Aug 28, 2009 at 11:15 AM, Richard Newman  wrote:

>
> > I am trying to play around with the clojure-twitter library (http://
> > github.com/mattrepl/clojure-twitter/tree) and it depends on clj-
> > apache-
> > http (http://github.com/rnewman/clj-apache-http/tree/master).
>
>
> This is my lib, so I'll answer :)
>
> > Now when I run:
> >
> >   java -cp CLASSPATH twitter.clj
>
> * Don't you mean $CLASSPATH?
>
> > I get this error:
> >
> >Exception in thread "main" java.io.FileNotFoundException: Could
> > not locate com/twinql/clojure/http__init.class or com/twinql/clojure/
> > http.clj on classpath:  (twitter.clj:0)
> >
> > When I printed my classpath in REPL, the clj-apache-http.jar is coming
> > up fine. Am I missing something?
>
> Do you also have all of clj-apache-http's dependencies on your
> classpath?
>
> commons-logging-1.1.1.jar
> httpclient-4.0-beta2.jar
> httpcore-4.0-beta3.jar
> httpmime-4.0-beta2.jar
>
> (Not sure about commons-logging... ain't my choice!)
>
> These are all in the lib/ dir.
>
> If those aren't on the classpath, com.twinql.clojure.http won't be
> compiled correctly, and thus won't be available.
>
> What does
>
> jar tf clj-apache-http.jar
>
> print?
>
> Feel free to reply off-list, as I doubt debugging classpaths is of
> much interest to the wider Clojure community.
>
> -R
>
> >
>

--~--~-~--~~~---~--~~
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: Lazy Exceptions

2009-08-28 Thread B Smith-Mannschott

On Fri, Aug 28, 2009 at 16:57, John Harrop wrote:
> On Fri, Aug 28, 2009 at 8:50 AM, Rich Hickey  wrote:
>>
>> On Thu, Aug 27, 2009 at 8:10 PM, Tim Snyder wrote:
>> >
>> > Well, I can see that LazySeq does indeed catch and wrap all Exceptions
>> > in a RuntimeException.  I also think I can work around it, but I'd
>> > like to know why this was done?
>> >
>> > Was it necessary given the checked vs. unchecked exception system of
>> > Java?
>> >
>>
>> Yes.
>
> What about declaring IFn.invoke() as "throws Exception"? Or did you think
> that would make calling Clojure from Java too painful? Or was there some
> other reason?

Actually, you *can* throw checked exceptions on the jvm without
declaring that you throw them. Neither the runtime nor the byte code
verifying enforce the "you must declare checked exceptions as thrown"
rule. This rule is enforced only by javac, and that can be gotten
around as was demonstrated recently by Reinier Zwitserloot in a
javaposse thread about exception handling:

http://groups.google.com/group/javaposse/msg/039f6590afe99390?dmode=source

public class Sneak {
public static RuntimeException
sneakyThrow(Throwable t) {
if ( t == null ) throw new NullPointerException("t");
Sneak.sneakyThrow0(t);
return null;
}

@SuppressWarnings("unchecked")
private static  void
sneakyThrow0(Throwable t) throws T {
throw (T)t;
}
}

Using something like this might be in extremely poor taste in Java,
but it I think it would fit right in for Clojure, which (thankfully)
doesn't distinguish between checked and unchecked exceptions.

// Ben

--~--~-~--~~~---~--~~
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: Lazy Exceptions

2009-08-28 Thread Rich Hickey

On Fri, Aug 28, 2009 at 10:57 AM, John Harrop wrote:
> On Fri, Aug 28, 2009 at 8:50 AM, Rich Hickey  wrote:
>>
>> On Thu, Aug 27, 2009 at 8:10 PM, Tim Snyder wrote:
>> >
>> > Well, I can see that LazySeq does indeed catch and wrap all Exceptions
>> > in a RuntimeException.  I also think I can work around it, but I'd
>> > like to know why this was done?
>> >
>> > Was it necessary given the checked vs. unchecked exception system of
>> > Java?
>> >
>>
>> Yes.
>
> What about declaring IFn.invoke() as "throws Exception"?

It is declared that way.

> Or did you think
> that would make calling Clojure from Java too painful?

Everything about checked exceptions is painful. Wrapped exceptions are
a fact of checked exceptions, since callers and base
classes/interfaces get to decide what problems (as yet unwritten)
callees/derivees can have (including none), e.g. Object.toString()
dictates no object can have a problem producing a string, but a lazy
sequence, whose contents are determined by calls to who-knows-what
functions, might have a problem in toString(). It's a bad system, I
didn't invent it, sorry.

> Or was there some
> other reason?

There are many other call paths that don't have Exception declared.

Rich

--~--~-~--~~~---~--~~
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: Why doesn't regex implement ifn?

2009-08-28 Thread Chouser

On Fri, Aug 28, 2009 at 10:01 AM, Shawn Hoover wrote:
>
> However, unless the platforms agree on literal regex
> syntax (they don't, beyond the basic "asdf|[0-9]+"
> features) will prevent true portability of the literals.

This is an interesting and crucial assertion.  If the regex
syntaxes do not have a useful overlap, only libraries that
allow regexs to "pass through" from the app to the platform
(creating no new regex objects of their own) will be
portable, at which point wrapping the pattern in
a clojure-something becomes rather less useful (except
I suppose for the original IFn point).

But is it true?  The amount of overlap between, for example,
JVM and JavaScript is quite substantial, both having
borrowed features and syntax quite heavily from perl.

http://www.regular-expressions.info/refflavors.html

I think that a s long as we're not trying to support ancient
engines (such as sed, awk, emacs...) the subset that
overlaps would be quite useful.

--Chouser

--~--~-~--~~~---~--~~
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: clj-apache-http not being found in classpath?

2009-08-28 Thread Richard Newman

> I am trying to play around with the clojure-twitter library (http://
> github.com/mattrepl/clojure-twitter/tree) and it depends on clj- 
> apache-
> http (http://github.com/rnewman/clj-apache-http/tree/master).


This is my lib, so I'll answer :)

> Now when I run:
>
>   java -cp CLASSPATH twitter.clj

* Don't you mean $CLASSPATH?

> I get this error:
>
>Exception in thread "main" java.io.FileNotFoundException: Could
> not locate com/twinql/clojure/http__init.class or com/twinql/clojure/
> http.clj on classpath:  (twitter.clj:0)
>
> When I printed my classpath in REPL, the clj-apache-http.jar is coming
> up fine. Am I missing something?

Do you also have all of clj-apache-http's dependencies on your  
classpath?

commons-logging-1.1.1.jar
httpclient-4.0-beta2.jar
httpcore-4.0-beta3.jar
httpmime-4.0-beta2.jar

(Not sure about commons-logging... ain't my choice!)

These are all in the lib/ dir.

If those aren't on the classpath, com.twinql.clojure.http won't be  
compiled correctly, and thus won't be available.

What does

 jar tf clj-apache-http.jar

print?

Feel free to reply off-list, as I doubt debugging classpaths is of  
much interest to the wider Clojure community.

-R

--~--~-~--~~~---~--~~
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: Why doesn't regex implement ifn?

2009-08-28 Thread Chas Emerick

On Aug 28, 2009, at 10:01 AM, Shawn Hoover wrote:

> Why wouldn't #"" produce whatever the corollary regex object is on
> each host platform?
>
> I had a couple suggestions on clojure-dev for ClojureCLR that line  
> up with the "produce the corollary idea": 
> http://groups.google.com/group/clojure-dev/browse_thread/thread/d4286dac9f1cf8ba/7e05daa7b782c075
>  
> .

Yeah, I wanted to find that thread yesterday, but (surprise!) couldn't.

>  Tangentially, if I think ahead a couple of 'moves', I'd think that
> perhaps there's a desire to have clojure code that is thoroughly
> portable between, say, Java and .NET host platforms.
>
> Essentially, as Chouser noted, #"" and re-seq as currently defined  
> in Clojure get you pretty far as a portable API. However, unless the  
> platforms agree on literal regex syntax (they don't, beyond the  
> basic "asdf|[0-9]+" features) will prevent true portability of the  
> literals.

Indeed.  FWIW, I was *definitely not* suggesting that soup-to-nuts  
portability across host platforms is a good idea -- I just see things  
that make me think that others would lean in that direction.

On Aug 28, 2009, at 9:00 AM, Rich Hickey wrote:

> I don't think moving specific applications between JVM/CLR/JS is a
> target, nor should it be. People need to move their expertise in the
> language, and core libraries, to different applications, which might
> have different target platforms.
>
> So, UI/web/DB libs IMO should not be portable. Life is too short.

I agree completely.  You can (and many have) spend a lifetime shimming  
APIs (or reimplementing them, for that matter).  People will do what  
they want of course, but there's a huge opportunity cost attached.

> Regex is interesting - is there a lot of core library code that uses
> it? Are there portable alternatives? It is quite likely that the
> native regex support on any platform will be best for that platform,
> so I'm inclined to think that #"" should follow "when in Rome"
> principles, and the burden should be on those who want portable regex
> to use something portable and eschew #"", but as I've said before, I'm
> not much of a regex user.

AFAIC, regex engines are platform facilities, like threading is.   
There's always going to be off-by-one differences (like those related  
to .NET's regex impl, nevermind the vastly different javascript impl),  
and any reimplementation will not be as heavily used, tested, or be as  
fast or feature-complete as the host platform's facility.  The same  
goes for concurrency approaches, graphics contexts, networking, etc.  
etc.

- Chas
--~--~-~--~~~---~--~~
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: Lazy Exceptions

2009-08-28 Thread John Harrop
On Fri, Aug 28, 2009 at 8:50 AM, Rich Hickey  wrote:

>
> On Thu, Aug 27, 2009 at 8:10 PM, Tim Snyder wrote:
> >
> > Well, I can see that LazySeq does indeed catch and wrap all Exceptions
> > in a RuntimeException.  I also think I can work around it, but I'd
> > like to know why this was done?
> >
> > Was it necessary given the checked vs. unchecked exception system of
> > Java?
> >
>
> Yes.
>

What about declaring IFn.invoke() as "throws Exception"? Or did you think
that would make calling Clojure from Java too painful? Or was there some
other reason?

--~--~-~--~~~---~--~~
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: Why doesn't regex implement ifn?

2009-08-28 Thread Chouser

On Thu, Aug 27, 2009 at 9:05 PM, Chas Emerick wrote:
>
>
> On Aug 27, 2009, at 1:34 PM, Chouser wrote:
>
>> The benefits of #"" producing a real java.util.regex.Pattern
>> object instead of some Clojury wrapper will decrease as it
>> becomes more common to write Clojure code that can run on
>> non-JVM platforms.  So although this idea has come up and
>> then been abandoned several times before, I think it's worth
>> bringing up again periodically to see what makes sense.
>
> Why wouldn't #"" produce whatever the corollary regex object is on
> each host platform?

What methods could you call on such a thing?  The answer
would differ depending on your platform, making the direct
calling of methods on such a thing undesirable as more
platforms are supported.

> Tangentially, if I think ahead a couple of 'moves', I'd think that
> perhaps there's a desire to have clojure code that is thoroughly
> portable between, say, Java and .NET host platforms.

Yes, exactly, at least for some subset of Clojure
functionality.  On the one hand, it's probably not worth
making Java binary serialization work transparently on
a JavaScript host, for example.  On the other hand, it'd be
nice (and not terribly difficult) to make
(re-seq #"x." "x1y2x3") return ("x1" "x3") on nearly every
platform being considered.  So it'd be nice if re-seq and
Clojure's other re-* functions always worked on whatever #""
produced, but it's less important for #"" to have any
particular set of native methods.

Of course you'd still want to provide a way to get to the
underlying platform-specific pattern object for cases where
you want to take advantage a platform feature in code that
doesn't have to be portable.

--Chouser

--~--~-~--~~~---~--~~
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: I18n

2009-08-28 Thread Stuart Sierra

My recommendation would be to keep your localized strings separate
from your source code, either in properties files or using a text
template system such as stringtemplate.org

-SS


On Aug 28, 1:16 am, ngocdaothanh  wrote:
> Hi all,
>
> Is there an i18n library for Clojure? What Java i18n library should I
> use in a Clojure program (it suits Clojure syntax for example)? For
> Ruby and Erlang I prefer Gettext, but for Java it seems
> that .properties files are in major use.
>
> Thanks,
> Ngoc.
--~--~-~--~~~---~--~~
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/EPL and the GPL

2009-08-28 Thread Matthias Benkard

On 28 Aug., 13:42, Tassilo Horn  wrote:
> I have a licensing question.  Am I allowed to include clojure.jar in a
> GPL project?

IANAL, but if I understand the GPL correctly, it prohibits you from
distributing a GPL-covered programme that is based on Clojure, because
it would need to be linked to the EPL'd Clojure library code and so
would make the combination have to be distributed under the GPL, which
is impossible.


> The reason is that we are thinking about (re)writing some components of
> our GPL java project in clojure.  Some of them might be core components,
> and so we would like to bundle the clojure.jar with the project.

Well, if it's _your_ project, obviously no one can stop you from
violating your own license.  Nobody else will be able to redistribute
your work, however.

What you can do to improve the situation in this case is to add an
exception to the license.  See 
http://www.gnu.org/licenses/old-licenses/gpl-2.0-faq.html#GPLIncompatibleLibs
for details.

If you don't own all of the GPL'd code, I think you're out of luck,
though.

Bye,
Matthias
--~--~-~--~~~---~--~~
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: I18n

2009-08-28 Thread cody koeninger



On Aug 28, 12:16 am, ngocdaothanh  wrote:
> Hi all,
>
> Is there an i18n library for Clojure? What Java i18n library should I
> use in a Clojure program (it suits Clojure syntax for example)? For
> Ruby and Erlang I prefer Gettext, but for Java it seems
> that .properties files are in major use.
>
> Thanks,
> Ngoc.


I have an interest in this as well.  Compared to using gettext, the
java style of resource files seems unnecessarily awkward.

There's a java api for gettext, described at
http://www.gnu.org/software/hello/manual/gettext/Java.html
I haven't used it yet, so I can't vouch for it.

You'd think that clojure syntax is, on its surface, close enough to
scheme that xgettext --language=Scheme  blah.clj would work for files
with forms like (_ "some string to be translated") .. . but it
doesn't.  Looks like writing a custom xgettext is going to be
necessary.

I had already hacked up some proof-of-concept clojure code using a
zipper to extract / translate strings from html files without any
additional markup.  Part of me thinks it'd be really nice to be able
to similarly identify a clojure source file as needing to be
translated, then extract any non-docstring text strings (or heck,
maybe even docstrings) automatically, without having to add the (_
"blah") markup.
--~--~-~--~~~---~--~~
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: Why doesn't regex implement ifn?

2009-08-28 Thread Shawn Hoover
On Thu, Aug 27, 2009 at 9:05 PM, Chas Emerick  wrote:

>
>
> On Aug 27, 2009, at 1:34 PM, Chouser wrote:
>
> > The benefits of #"" producing a real java.util.regex.Pattern
> > object instead of some Clojury wrapper will decrease as it
> > becomes more common to write Clojure code that can run on
> > non-JVM platforms.  So although this idea has come up and
> > then been abandoned several times before, I think it's worth
> > bringing up again periodically to see what makes sense.
>
> Why wouldn't #"" produce whatever the corollary regex object is on
> each host platform?
>

I had a couple suggestions on clojure-dev for ClojureCLR that line up with
the "produce the corollary idea":
http://groups.google.com/group/clojure-dev/browse_thread/thread/d4286dac9f1cf8ba/7e05daa7b782c075
.



> Tangentially, if I think ahead a couple of 'moves', I'd think that
> perhaps there's a desire to have clojure code that is thoroughly
> portable between, say, Java and .NET host platforms.
>

Essentially, as Chouser noted, #"" and re-seq as currently defined in
Clojure get you pretty far as a portable API. However, unless the platforms
agree on literal regex syntax (they don't, beyond the basic "asdf|[0-9]+"
features) will prevent true portability of the literals.

Shawn

--~--~-~--~~~---~--~~
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: Java STM

2009-08-28 Thread John Harrop
On Fri, Aug 28, 2009 at 4:45 AM, peter veentjer wrote:

> > Clojure's STM is part of a holistic language design where
> > people will normally be programming with immutable persistent
> > composite data structures. Getting a consistent view of such a data
> > structure doesn't require a transaction at all, so that is much faster
> > than other strategies. When 'changing' a data structure, you read it
> > from the ref once and then structural changes do not involve the STM
> > or refs. Store it back in the ref when done. Thus the granularity of
> > transactions is coarse and the number of ref interactions involved
> > small. These are not things you'll see when timing pounding an integer
> > in a transactional ref in a tight loop, but matter greatly in
> > practice, IMO.
>
> I partly agree. One of my design guidelines is that one should not
> have to pay
> for what is not being used.
>
> One of the things I'm focussing on is making the transaction
> as fast as possible for any length. I'm working on a system that
> advices the
> creation of a transaction with the maximum number of attached objects.
> I have
>  a transaction optimised for a single attachment (5+M transactions/
> second on a single core),
> for a small number of attachments (so using an array to store attached
> items to reduce object creation)
> and one for a large number of attachments (so using an expensive
> hashmap).
> The later one also is going to get a parallel commit (so obtaining
> locks/checking for
> isolation problems.. and doing the write) to make effective use of the
> cores and speed
> up the commit of larger transactions.


For a single "attachment" Clojure has atoms and agents instead of an
optimized specialization of refs and dosync. :)

--~--~-~--~~~---~--~~
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: Java STM

2009-08-28 Thread Rich Hickey

On Fri, Aug 28, 2009 at 4:45 AM, peter veentjer wrote:
>
>> No. I don't want to use transactions for workflow. I don't want
>> blocking transactions. I don't want read tracking.
>
> With multiverse it depends on the engine being used and the settings
> on the transaction. And readonly transactions also don't track reads.
>
>> > And since Clojure is using MVCC, does it also suffer from a broken
>> > serialized isolation 
>> > level?http://pveentjer.wordpress.com/2008/10/04/breaking-oracle-serializable/
>>
>> Clojure doesn't promise any "serialized isolation level". It provides
>> snapshot isolation, which is subject to write skew, as better
>> described here:
>>
>> http://en.wikipedia.org/wiki/Snapshot_isolation
>>
>> In order to prevent write skew, Clojure provides the 'ensure'
>> operation which can be used for reads to non-written refs that form
>> part of the integrity promise of a transaction, without incurring that
>> overhead all the time for reads that do not. I much prefer having this
>> fine-grained choice.
>
> I'll have a look at it.
>
>>
>> > And what kind of performance do you get with clojure?
>>
>> I'll let other people answer that from their experience, but only say
>> that it is probably too general a question to be particularly
>> meaningful.
>
> True.
>
>> Clojure's STM is part of a holistic language design where
>> people will normally be programming with immutable persistent
>> composite data structures. Getting a consistent view of such a data
>> structure doesn't require a transaction at all, so that is much faster
>> than other strategies. When 'changing' a data structure, you read it
>> from the ref once and then structural changes do not involve the STM
>> or refs. Store it back in the ref when done. Thus the granularity of
>> transactions is coarse and the number of ref interactions involved
>> small. These are not things you'll see when timing pounding an integer
>> in a transactional ref in a tight loop, but matter greatly in
>> practice, IMO.
>
> I partly agree. One of my design guidelines is that one should not
> have to pay
> for what is not being used.
>
> One of the things I'm focussing on is making the transaction
> as fast as possible for any length. I'm working on a system that
> advices the
> creation of a transaction with the maximum number of attached objects.
> I have
>  a transaction optimised for a single attachment (5+M transactions/
> second on a single core),
> for a small number of attachments (so using an array to store attached
> items to reduce object creation)
> and one for a large number of attachments (so using an expensive
> hashmap).
> The later one also is going to get a parallel commit (so obtaining
> locks/checking for
> isolation problems.. and doing the write) to make effective use of the
> cores and speed
> up the commit of larger transactions.
>
> So I'm working on all levels to make it as fast as possible and
> pounding
> on an intref is something that helps to find a subset of problem
> areas. And if something
> is fast enough, people don't try to work around it.. so it also helps
> to reduce complexity imho.
>

And I'm not arguing against fast STMs :) Just explaining that, because
my ideas about STM (you shouldn't need a transaction to see a
consistent object) required persistent data structures and a language
where they were pervasive and idiomatic, I ended up with a whole
language and an approach that includes certain efficiencies, which, I
think, will hold me (and Clojure users) until I (or someone) get
around to perf-tuning the STM, which is something I've spent no time
on at all. You know the old saws, "make it right, then make it fast",
"premature optimization is the root of all evil in programming"... I'm
still working on the "make it right" phase :)

Rich

> But again, I think that clojure is doing a great job. You have a cool
> language,
>  a cool stm, an active community and a lot of exposure. So you are
> where I
> want to be :)
>
>> Rich
>> > PS:
>> > I think that Clojure really did a great job with adding STM to the
>> > language. I have been working on multiverse for almost a year,
>> > and I only have an stm. With Clojure the STM is one of the many
>> > features provided.
>>
>> > > On Mon, Jul 13, 2009 at 2:07 AM, Vagif Verdi 
>> > > wrote:
>>
>> > > > Potentially interesting library for clojurians. Java STM
>> > > > implementation:http://www.deucestm.org/
>>
>> > > --
>> > > Venlig hilsen / Kind regards,
>> > > Christian Vest Hansen.
> >
>

--~--~-~--~~~---~--~~
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: with-open should use a close multimethod?

2009-08-28 Thread C. Florian Ebeling

+1

Coming across that problem just yesterday.

On Fri, Aug 28, 2009 at 3:54 PM, Sean Devlin wrote:
>
> +1
>
> On Aug 28, 9:41 am, Chas Emerick  wrote:
>> Definitely +1, yes.
>>
>> - Chas
>>
>> On Aug 28, 2009, at 4:27 AM, Mike Hinchey wrote:
>>
>> > I have a suggestion for the with-open macro.  It calls .close when
>> > it's finished.  I'd like it to have a (defmulti close type) so it's
>> > behavior is extensible.  A standard method could be defined for
>> > java.io.Closeable and a :default method with no type hint.  I've
>> > come across a few cases where some external library defines what is
>> > essentially a close method but names it shutdown or disable, etc.,
>> > and defining my own close method would be much easier than rewriting
>> > with-open.  This would also allow people to eliminate reflection for
>> > classes like sql Connection that were created before Closeable.
>>
>> > I'll submit a patch if it's wanted.  This would fit in core, or
>> > maybe contrib.duck-streams with a slightly different name.
>>
>> > -Mike
> >
>



-- 
Florian Ebeling
florian.ebel...@gmail.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
-~--~~~~--~~--~--~---



clj-apache-http not being found in classpath?

2009-08-28 Thread dmix

I am trying to play around with the clojure-twitter library (http://
github.com/mattrepl/clojure-twitter/tree) and it depends on clj-apache-
http (http://github.com/rnewman/clj-apache-http/tree/master).

So I cloned the repo, built it with ant and added the clj-apache-
http.jar to my classpath.

Now when I run:

   java -cp CLASSPATH twitter.clj

I get this error:

Exception in thread "main" java.io.FileNotFoundException: Could
not locate com/twinql/clojure/http__init.class or com/twinql/clojure/
http.clj on classpath:  (twitter.clj:0)

When I printed my classpath in REPL, the clj-apache-http.jar is coming
up fine. Am I missing something?

--~--~-~--~~~---~--~~
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: with-open should use a close multimethod?

2009-08-28 Thread J. McConnell
+1

On Fri, Aug 28, 2009 at 4:27 AM, Mike Hinchey  wrote:

> I have a suggestion for the with-open macro.  It calls .close when it's
> finished.  I'd like it to have a (defmulti close type) so it's behavior is
> extensible.  A standard method could be defined for java.io.Closeable and a
> :default method with no type hint.  I've come across a few cases where some
> external library defines what is essentially a close method but names it
> shutdown or disable, etc., and defining my own close method would be much
> easier than rewriting with-open.  This would also allow people to eliminate
> reflection for classes like sql Connection that were created before
> Closeable.
>
> I'll submit a patch if it's wanted.  This would fit in core, or maybe
> contrib.duck-streams with a slightly different name.
>
> -Mike
>
>
> >
>

--~--~-~--~~~---~--~~
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: Why doesn't regex implement ifn?

2009-08-28 Thread Rich Hickey

On Thu, Aug 27, 2009 at 9:05 PM, Chas Emerick wrote:
>
>
> On Aug 27, 2009, at 1:34 PM, Chouser wrote:
>
>> The benefits of #"" producing a real java.util.regex.Pattern
>> object instead of some Clojury wrapper will decrease as it
>> becomes more common to write Clojure code that can run on
>> non-JVM platforms.  So although this idea has come up and
>> then been abandoned several times before, I think it's worth
>> bringing up again periodically to see what makes sense.
>
> Why wouldn't #"" produce whatever the corollary regex object is on
> each host platform?
>
> Tangentially, if I think ahead a couple of 'moves', I'd think that
> perhaps there's a desire to have clojure code that is thoroughly
> portable between, say, Java and .NET host platforms.
>

I don't think moving specific applications between JVM/CLR/JS is a
target, nor should it be. People need to move their expertise in the
language, and core libraries, to different applications, which might
have different target platforms.

So, UI/web/DB libs IMO should not be portable. Life is too short.
Regex is interesting - is there a lot of core library code that uses
it? Are there portable alternatives? It is quite likely that the
native regex support on any platform will be best for that platform,
so I'm inclined to think that #"" should follow "when in Rome"
principles, and the burden should be on those who want portable regex
to use something portable and eschew #"", but as I've said before, I'm
not much of a regex user.

Other thoughts?

Rich

--~--~-~--~~~---~--~~
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: Lazy Exceptions

2009-08-28 Thread Rich Hickey

On Thu, Aug 27, 2009 at 8:10 PM, Tim Snyder wrote:
>
> Well, I can see that LazySeq does indeed catch and wrap all Exceptions
> in a RuntimeException.  I also think I can work around it, but I'd
> like to know why this was done?
>
> Was it necessary given the checked vs. unchecked exception system of
> Java?
>

Yes.

Rich

> Is it because the exception generated by a lazy sequence may no longer
> be within the dynamic confines of the 'try' in which it was called and
> thus should be considered a runtime exception?
>
> Tim Snyder wrote:
>> Thanks for the replies.  I'll have a look at the impl. of LazySeq
>> tonight and see if that helps.  It sounds like it shouldn't be a
>> problem to work around though.  Is there somewhere I can read that
>> gives an explanation or information about why this is done?
>>
>> On Aug 27, 9:33 am, Meikel Brandmeyer  wrote:
>> > Hi,
>> >
>> > On Aug 27, 5:47 am, Tim Snyder  wrote:
>> >
>> >
>> >
>> >
>> >
>> > > I'm trying to understand how laziness affects exception handling.  I
>> > > keep finding my exceptions wrapped in RuntimeExceptions.
>> >
>> > > If I have code that just throws an exception, I get what I'd expect:
>> > > (throw (Exception. "Plain Exception")) -->
>> > > Plain Exception
>> > >  [thrown class java.lang.Exception]
>> >
>> > > On the other hand if I make the exception lazy, it is always wrapped
>> > > in a RuntimeException:
>> > > (lazy-seq
>> > >   [(throw (Exception.
>> > >      "NotPlainException"))])  -->
>> > > java.lang.Exception: NotPlainException
>> > >   [Thrown class java.lang.RuntimeException]
>> >
>> > > This of course makes it harder to deal with the exceptions.  I've
>> > > looked through the stack traces but can't see any solution.  Is this
>> > > due to the Java difference between checked and unchecked exceptions?
>> > > Is there a reasonable way to work around it?  Doall has no effect.
>> >
>> > You can travel down the exception chain by means of .getCause. Do that
>> > until you find your Exception or maybe until the cause is not a
>> > RuntimeException anymore. If you didn't find something of concern
>> > rethrow the original exception. Does that make sense?
>> >
>> > Sincerely
>> > Meikel
> >
>

--~--~-~--~~~---~--~~
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: with-open should use a close multimethod?

2009-08-28 Thread Chas Emerick

Definitely +1, yes.

- Chas

On Aug 28, 2009, at 4:27 AM, Mike Hinchey wrote:

> I have a suggestion for the with-open macro.  It calls .close when  
> it's finished.  I'd like it to have a (defmulti close type) so it's  
> behavior is extensible.  A standard method could be defined for  
> java.io.Closeable and a :default method with no type hint.  I've  
> come across a few cases where some external library defines what is  
> essentially a close method but names it shutdown or disable, etc.,  
> and defining my own close method would be much easier than rewriting  
> with-open.  This would also allow people to eliminate reflection for  
> classes like sql Connection that were created before Closeable.
>
> I'll submit a patch if it's wanted.  This would fit in core, or  
> maybe contrib.duck-streams with a slightly different name.
>
> -Mike

--~--~-~--~~~---~--~~
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: vimclojure issues

2009-08-28 Thread Meikel Brandmeyer

Hi,

On Aug 28, 10:36 am, viksit  wrote:
> Actually, I've got the same problem.
>
> (defn greet [] (println "Hello, World!"))
>
> With \et.
>
> example2.clj
> 1,7All
> Error detected while processing function
> vimclojure#EvalToplevel:
> line8:
> E605: Exception not caught: Error: Not in toplevel expression!
> Press ENTER or type command to continue
>
> The same problem hapens when the cursor is at d, e, or anything inside
> the parens.
>
> \sr works fine.
>
> I've tried this with syntax=on and off - which doesnt' make a
> difference.

When you place the cursor *on* the opening paren and execute the
following command:

:echo synIDattr(synID(line("."), col("."), 1), "name")

What does it say?

Sincerely
Meikel

PS: Which VC version are you using, BTW.
--~--~-~--~~~---~--~~
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: with-open should use a close multimethod?

2009-08-28 Thread Sean Devlin

+1

On Aug 28, 9:41 am, Chas Emerick  wrote:
> Definitely +1, yes.
>
> - Chas
>
> On Aug 28, 2009, at 4:27 AM, Mike Hinchey wrote:
>
> > I have a suggestion for the with-open macro.  It calls .close when  
> > it's finished.  I'd like it to have a (defmulti close type) so it's  
> > behavior is extensible.  A standard method could be defined for  
> > java.io.Closeable and a :default method with no type hint.  I've  
> > come across a few cases where some external library defines what is  
> > essentially a close method but names it shutdown or disable, etc.,  
> > and defining my own close method would be much easier than rewriting  
> > with-open.  This would also allow people to eliminate reflection for  
> > classes like sql Connection that were created before Closeable.
>
> > I'll submit a patch if it's wanted.  This would fit in core, or  
> > maybe contrib.duck-streams with a slightly different name.
>
> > -Mike
--~--~-~--~~~---~--~~
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: vimclojure issues

2009-08-28 Thread viksit

Actually, I've got the same problem.

(defn greet [] (println "Hello, World!"))

With \et.

example2.clj
1,7All
Error detected while processing function
vimclojure#EvalToplevel:
line8:
E605: Exception not caught: Error: Not in toplevel expression!
Press ENTER or type command to continue

The same problem hapens when the cursor is at d, e, or anything inside
the parens.

\sr works fine.

I've tried this with syntax=on and off - which doesnt' make a
difference.

Cheers
Viksit

On Aug 24, 1:23 pm, Meikel Brandmeyer  wrote:
> Hi,
>
> Am 24.08.2009 um 21:37 schrieb Sang Ahn:
>
> > I have the same issue even w/ the cursor directly above the 'd'  
> > character.
>
> Hmm... Do you have syntax highlighting turned on?
>
> Sincerely
> Meikel
>
>  smime.p7s
> 2KViewDownload

--~--~-~--~~~---~--~~
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: Lazy Exceptions

2009-08-28 Thread Meikel Brandmeyer

Hi,

On Aug 28, 6:07 am, eyeris  wrote:

> When you say "the original" do you mean the outer-most
> RuntimeException or the inner-most exception?

It think I meant the outer-most exception.

Sincerely
Meikel

--~--~-~--~~~---~--~~
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/EPL and the GPL

2009-08-28 Thread Tassilo Horn

Hi all,

I have a licensing question.  Am I allowed to include clojure.jar in a
GPL project?

On the net I've found out that the EPL is not GPL compliant, and there's
an explicit statement by the FSF that it's not possible to include GPL
code inside an EPL licensed project, or to create an EPL licensed
derived work from GPL works.  But how about the other way round?

The reason is that we are thinking about (re)writing some components of
our GPL java project in clojure.  Some of them might be core components,
and so we would like to bundle the clojure.jar with the project.

Bye,
Tassilo

--~--~-~--~~~---~--~~
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: with-open should use a close multimethod?

2009-08-28 Thread Seth

Sounds good to me.

On Aug 28, 4:27 am, Mike Hinchey  wrote:
> I have a suggestion for the with-open macro.  It calls .close when it's
> finished.  I'd like it to have a (defmulti close type) so it's behavior is
> extensible.  A standard method could be defined for java.io.Closeable and a
> :default method with no type hint.  I've come across a few cases where some
> external library defines what is essentially a close method but names it
> shutdown or disable, etc., and defining my own close method would be much
> easier than rewriting with-open.  This would also allow people to eliminate
> reflection for classes like sql Connection that were created before
> Closeable.
>
> I'll submit a patch if it's wanted.  This would fit in core, or maybe
> contrib.duck-streams with a slightly different name.
>
> -Mike
--~--~-~--~~~---~--~~
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: Java STM

2009-08-28 Thread Emeka
Peter, you will get there some day.



On Fri, Aug 28, 2009 at 8:45 AM, peter veentjer wrote:

>
> > No. I don't want to use transactions for workflow. I don't want
> > blocking transactions. I don't want read tracking.
>
> With multiverse it depends on the engine being used and the settings
> on the transaction. And readonly transactions also don't track reads.
>
> > > And since Clojure is using MVCC, does it also suffer from a broken
> > > serialized isolation level?
> http://pveentjer.wordpress.com/2008/10/04/breaking-oracle-serializable/
> >
> > Clojure doesn't promise any "serialized isolation level". It provides
> > snapshot isolation, which is subject to write skew, as better
> > described here:
> >
> > http://en.wikipedia.org/wiki/Snapshot_isolation
> >
> > In order to prevent write skew, Clojure provides the 'ensure'
> > operation which can be used for reads to non-written refs that form
> > part of the integrity promise of a transaction, without incurring that
> > overhead all the time for reads that do not. I much prefer having this
> > fine-grained choice.
>
> I'll have a look at it.
>
> >
> > > And what kind of performance do you get with clojure?
> >
> > I'll let other people answer that from their experience, but only say
> > that it is probably too general a question to be particularly
> > meaningful.
>
> True.
>
> > Clojure's STM is part of a holistic language design where
> > people will normally be programming with immutable persistent
> > composite data structures. Getting a consistent view of such a data
> > structure doesn't require a transaction at all, so that is much faster
> > than other strategies. When 'changing' a data structure, you read it
> > from the ref once and then structural changes do not involve the STM
> > or refs. Store it back in the ref when done. Thus the granularity of
> > transactions is coarse and the number of ref interactions involved
> > small. These are not things you'll see when timing pounding an integer
> > in a transactional ref in a tight loop, but matter greatly in
> > practice, IMO.
>
> I partly agree. One of my design guidelines is that one should not
> have to pay
> for what is not being used.
>
> One of the things I'm focussing on is making the transaction
> as fast as possible for any length. I'm working on a system that
> advices the
> creation of a transaction with the maximum number of attached objects.
> I have
>  a transaction optimised for a single attachment (5+M transactions/
> second on a single core),
> for a small number of attachments (so using an array to store attached
> items to reduce object creation)
> and one for a large number of attachments (so using an expensive
> hashmap).
> The later one also is going to get a parallel commit (so obtaining
> locks/checking for
> isolation problems.. and doing the write) to make effective use of the
> cores and speed
> up the commit of larger transactions.
>
> So I'm working on all levels to make it as fast as possible and
> pounding
> on an intref is something that helps to find a subset of problem
> areas. And if something
> is fast enough, people don't try to work around it.. so it also helps
> to reduce complexity imho.
>
> But again, I think that clojure is doing a great job. You have a cool
> language,
>  a cool stm, an active community and a lot of exposure. So you are
> where I
> want to be :)
>
> > Rich
> > > PS:
> > > I think that Clojure really did a great job with adding STM to the
> > > language. I have been working on multiverse for almost a year,
> > > and I only have an stm. With Clojure the STM is one of the many
> > > features provided.
> >
> > > > On Mon, Jul 13, 2009 at 2:07 AM, Vagif Verdi
> wrote:
> >
> > > > > Potentially interesting library for clojurians. Java STM
> > > > > implementation:http://www.deucestm.org/
> >
> > > > --
> > > > Venlig hilsen / Kind regards,
> > > > Christian Vest Hansen.
> >
>

--~--~-~--~~~---~--~~
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: Java STM

2009-08-28 Thread peter veentjer

> No. I don't want to use transactions for workflow. I don't want
> blocking transactions. I don't want read tracking.

With multiverse it depends on the engine being used and the settings
on the transaction. And readonly transactions also don't track reads.

> > And since Clojure is using MVCC, does it also suffer from a broken
> > serialized isolation 
> > level?http://pveentjer.wordpress.com/2008/10/04/breaking-oracle-serializable/
>
> Clojure doesn't promise any "serialized isolation level". It provides
> snapshot isolation, which is subject to write skew, as better
> described here:
>
> http://en.wikipedia.org/wiki/Snapshot_isolation
>
> In order to prevent write skew, Clojure provides the 'ensure'
> operation which can be used for reads to non-written refs that form
> part of the integrity promise of a transaction, without incurring that
> overhead all the time for reads that do not. I much prefer having this
> fine-grained choice.

I'll have a look at it.

>
> > And what kind of performance do you get with clojure?
>
> I'll let other people answer that from their experience, but only say
> that it is probably too general a question to be particularly
> meaningful.

True.

> Clojure's STM is part of a holistic language design where
> people will normally be programming with immutable persistent
> composite data structures. Getting a consistent view of such a data
> structure doesn't require a transaction at all, so that is much faster
> than other strategies. When 'changing' a data structure, you read it
> from the ref once and then structural changes do not involve the STM
> or refs. Store it back in the ref when done. Thus the granularity of
> transactions is coarse and the number of ref interactions involved
> small. These are not things you'll see when timing pounding an integer
> in a transactional ref in a tight loop, but matter greatly in
> practice, IMO.

I partly agree. One of my design guidelines is that one should not
have to pay
for what is not being used.

One of the things I'm focussing on is making the transaction
as fast as possible for any length. I'm working on a system that
advices the
creation of a transaction with the maximum number of attached objects.
I have
 a transaction optimised for a single attachment (5+M transactions/
second on a single core),
for a small number of attachments (so using an array to store attached
items to reduce object creation)
and one for a large number of attachments (so using an expensive
hashmap).
The later one also is going to get a parallel commit (so obtaining
locks/checking for
isolation problems.. and doing the write) to make effective use of the
cores and speed
up the commit of larger transactions.

So I'm working on all levels to make it as fast as possible and
pounding
on an intref is something that helps to find a subset of problem
areas. And if something
is fast enough, people don't try to work around it.. so it also helps
to reduce complexity imho.

But again, I think that clojure is doing a great job. You have a cool
language,
 a cool stm, an active community and a lot of exposure. So you are
where I
want to be :)

> Rich
> > PS:
> > I think that Clojure really did a great job with adding STM to the
> > language. I have been working on multiverse for almost a year,
> > and I only have an stm. With Clojure the STM is one of the many
> > features provided.
>
> > > On Mon, Jul 13, 2009 at 2:07 AM, Vagif Verdi wrote:
>
> > > > Potentially interesting library for clojurians. Java STM
> > > > implementation:http://www.deucestm.org/
>
> > > --
> > > Venlig hilsen / Kind regards,
> > > Christian Vest Hansen.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



with-open should use a close multimethod?

2009-08-28 Thread Mike Hinchey
I have a suggestion for the with-open macro.  It calls .close when it's
finished.  I'd like it to have a (defmulti close type) so it's behavior is
extensible.  A standard method could be defined for java.io.Closeable and a
:default method with no type hint.  I've come across a few cases where some
external library defines what is essentially a close method but names it
shutdown or disable, etc., and defining my own close method would be much
easier than rewriting with-open.  This would also allow people to eliminate
reflection for classes like sql Connection that were created before
Closeable.

I'll submit a patch if it's wanted.  This would fit in core, or maybe
contrib.duck-streams with a slightly different name.

-Mike

--~--~-~--~~~---~--~~
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 vs scala

2009-08-28 Thread Emeka
e,

I just picked a new word 'Rogramming'?

Regards,
Emeka

On Fri, Aug 28, 2009 at 1:30 AM, e  wrote:

>
>
>  On Thu, Aug 27, 2009 at 9:57 AM, Emeka  wrote:
>
>> e,
>>
>> What is inspiring in it?
>>
>
> H  from time to time, people use percent literacy as a measure of
> public intellectual health, right?  In that case, it's sort of obvious that
> literacy is a goal.   Well, I'm wondering if we need to add a 4th
> fundamental to the 3 R's (Reading, Riting and 'Rithmetic) ... namely
> 'Rogramming.  That opens up a lot of conversation.  To summarize a paragraph
> that I just erase (was getting a little silly), to me Stuart's point is the
> same as to say that it is not the intent of poems (or even some good movies)
> to be understood completely, all at once, and right away.  There are plenty
> of other worthwhile things in that category, too ... like perhaps clojure.
>
>
>
>>
>> Regards,
>> Emeka
>>
>>   On Thu, Aug 27, 2009 at 1:44 PM, e  wrote:
>>
>>>  On Thu, Aug 27, 2009 at 8:43 AM, Stuart Halloway <
>>> stuart.hallo...@gmail.com> wrote:
>>>

 As the author of the book, you can bet I have an opinion on the
 quality of the docs. :-)

 (1) I think the documentation for Clojure (website, Mark Volkmann's
 long article [1], blog posts, the book [2]) is *insanely* good, given
 how young the language is. But...

 (2) If you are coming from a mainstream business software environment,
 there are a ton of new ideas in Clojure. There's more to learn, so of
 course it is going be harder, and take longer. You won't get there
 just by reading one book, even if you work through all the code
 examples. I *love* that Rich's recommended reading list [3] has not 2,
 or 4, but 36 books!! Clojure stands in opposition to the "in 21 days
 for dummies" [4] school of thought.

 (3) Scala's just as hard to learn, because it too is full of ideas
 that are new to many developers. I would love to see the 36-book list
 for learning Scala, and I bet there would be significant overlap.

 (4) I think the Clojure docstrings  are ok, but could be improved by
 usage examples. Rich, are you interested in patches that simply add
 examples to docstrings?

 In short: if you are the median developer, both Clojure and Scala are
 huge improvements over the language you are using right now. But you
 won't be effective in either one of them tomorrow:  the learning curve
 is not 1, but 5-10 books.

 So let's raise the bar. In the world I want to live in, programmers
 above the novice level would understand the ideas in both Clojure and
 Scala. Learn both. :-)

 Cheers,
 Stu

 [1] http://java.ociweb.com/mark/clojure/article.html
 [2] http://www.pragprog.com/titles/shcloj/programming-clojure
 [3] http://tinyurl.com/clojure-bookshelf
 [4] http://norvig.com/21-days.html

>>>
>>> awesome post.  Inspiring.
>>>


 >
 > I think there are a lot of people who need to choose between Clojure
 > and Scala to study as a "new" language. I must say that both are bad:
 > * Clojure doc is hard to understand.
 > * Scala grammar is complicated.
 >
 > I prefer Clojure. I think Clojure feature at this time is OK, thus the
 > decisive point to draw people to Clojure is doc. I wonder if the doc
 > at this time is obvious for LISP people, but comming from C/C++, Java,
 > Ruby, and Erlang (Erlang doc is bad, but it is paradise compared to
 > that of Clojure :D) and even after reading the Clojure book, I must
 > say that I can't understand 99% of the doc of both clojure and
 > clojure-
 > contrib.
 >
 > For example, what does the following mean?
 > -
 > (-> x form)
 > (-> x form & more)
 > Macro
 > Threads the expr through the forms. Inserts x as the second item in
 > the first form, making a list of it if it is not a list already. If
 > there are more forms, inserts the first form as the second item in
 > second form, etc.
 > -
 >
 > My wish: There are easy-to-understand examples in API doc.
 >
 > Rails is easy to use largely because there are examples in doc of
 > every API function.
 >
 >
 > On Aug 26, 12:37 pm, Alan Busby  wrote:
 >> On Wed, Aug 26, 2009 at 5:43 AM, npowell 
 >> wrote:
 >>
 >>> I mean, I didn't think the article was terribly in depth, but a
 >>> real,
 >>> evenhanded comparison would be enlightening.
 >>
 >> Reducing it further, I'd be interested just to hear more about the
 >> contrast
 >> of static typing versus macros. Which is more beneficial for
 >> different
 >> situations and why?
 > >




>>>
>>>
>>>
>>
>>
>>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to t