Patch policy?

2 views
Skip to first unread message

Allen Rohner

unread,
Jul 1, 2008, 4:10:29 PM7/1/08
to Clojure
Rich, first off, I'd like to say thank you for building Clojure. I've
been really happy with the language so far, and I would love to
continue using it.

I've had a few minor ideas for things I'd like to improve. A few
questions:
1) Are you accepting code contributions for things that can't fit into
clojure-contrib?
2) What is the best way to submit the code? Posting the patch to the
group, Git, etc?

Allen

Rich Hickey

unread,
Jul 1, 2008, 8:46:24 PM7/1/08
to Clojure
You can post patches here, but it's usually a good idea to talk about
the ideas here first before creating patches.

Rich

Allen Rohner

unread,
Jul 2, 2008, 12:25:07 AM7/2/08
to Clojure

> You can post patches here, but it's usually a good idea to talk about
> the ideas here first before creating patches.
>
> Rich

So a minor annoyance of mine is that (doc <any special form>) throws a
stack trace:

user=> (doc if)
java.lang.Exception: Unable to resolve var: if in this context
clojure.lang.Compiler$CompilerException: NO_SOURCE_FILE:2295: Unable
to resolve var: if in this context
at clojure.lang.Compiler.analyzeSeq(Compiler.java:3759)
at clojure.lang.Compiler.analyze(Compiler.java:3614)
at clojure.lang.Compiler.analyze(Compiler.java:3589)
at clojure.lang.Compiler.access$100(Compiler.java:37)
...

I'd like to fix this so that doc can be used on special forms, or at
least doesn't throw a stack trace.

The following works, but I'm not sure it's a good idea:
(def #^{:doc "evalutes test, then evalutes and yields then, or
evalutes else" :arglists '(if test then else)} if nil)

Then (doc if) works, but then this is weird:
=>(def if nil)
nil
=>(def bar nil)
nil
=>(= bar if)
true

Thoughts?

Allen


Chas Emerick

unread,
Jul 2, 2008, 5:38:57 PM7/2/08
to Clojure
On Jul 2, 12:25 am, Allen Rohner <aroh...@gmail.com> wrote:
> Then (doc if) works, but then this is weird:
> =>(def if nil)
> nil
> =>(def bar nil)
> nil
> =>(= bar if)
> true
>
> Thoughts?

That's right -- nil is equal to nil (no null pointers, thankfully!)

(= nil nil) => true

- Chas

Allen Rohner

unread,
Jul 2, 2008, 5:58:11 PM7/2/08
to Clojure
>> So a minor annoyance of mine is that (doc <any special form>) throws a
>> stack trace:
>> I'd like to fix this so that (doc) can be used on special forms, or at
>> least doesn't throw a stack trace.
>
>> The following works, but I'm not sure it's a good idea:
>> (def #^{:doc "evalutes test, then evalutes and yields then, or
>> evalutes else" :arglists '(if test then else)} if nil)
>

> > Then (doc if) works, but then this is weird:
> > =>(def if nil)
> > nil
> > =>(def bar nil)
> > nil
> > =>(= bar if)
> > true
>
> > Thoughts?
>
> That's right -- nil is equal to nil (no null pointers, thankfully!)
>
> (= nil nil) => true
>
> - Chas

I understand that (= if bar) is supposed to work. I was pointing out
that it is weird because one of my symbols has the same name as a
special form . If you def a symbol with the same name as a special
form, it acts like a symbol, up until you begin a sequence with it:

user=> (def bar print)
#'user/bar
user=> (def if print)
#'user/if
user=> (bar "hello")
hellonil
user=> (if "hello")
java.lang.Exception: Too few arguments to if
clojure.lang.Compiler$CompilerException: NO_SOURCE_FILE:4: Too few
arguments to if
at clojure.lang.Compiler.analyzeSeq(Compiler.java:3759)
at clojure.lang.Compiler.analyze(Compiler.java:3614)
at clojure.lang.Compiler.analyze(Compiler.java:3589)
at clojure.lang.Compiler.eval(Compiler.java:3779)
at clojure.lang.Repl.main(Repl.java:75)


--Allen


Reply all
Reply to author
Forward
0 new messages