Re: Why no def- ?

2011-01-25 Thread Benjamin Teuber
Ok, I think I've got it - so basically all private variants should go in contrib now and moving defn- now would break a lot of people's code just for a little more coherency. But in this case, I'd like def- to be included in clojure.contrib.def. I dislike defvar as it's just name and docstring

Re: Why no def- ?

2011-01-25 Thread OGINO Masanori
Hello. If def- remains for historical reason, def- may be marked as duplicated and will be moved, for example, in 1.4, 2.0 or so? Thank you. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@gmail.com -- You received this message because you are subscribed to the Google Groups Clojure

Re: Why no def- ?

2011-01-24 Thread Jeff Rose
On Jan 22, 5:13 pm, Stuart Halloway stuart.hallo...@gmail.com wrote: Please don't. It has already been discussed and declined. The metadata is uglier because we want doing this to be slightly ugly.. The Clojure/core team is led by its technical advisors, Rich Hickey and myself.  In this

Re: Why no def- ?

2011-01-24 Thread Nick Brown
Ugly? Aww, I thought the ^ metadata looked kinda cute... It is a bit awkward that defn- exists and not def-, but it seems defs are not going to be as common as defns (though I'll admit I haven't written or read enough complex idiomatic Clojure code to know for sure). And if you really want to

Re: Why no def- ?

2011-01-24 Thread Ken Wesson
On Mon, Jan 24, 2011 at 8:42 PM, Nick Brown nwbr...@gmail.com wrote: Ugly?  Aww, I thought the ^ metadata looked kinda cute... It is a bit awkward that defn- exists and not def-, but it seems defs are not going to be as common as defns (though I'll admit I haven't written or read enough

Re: Why no def- ?

2011-01-24 Thread OGINO Masanori
Hello. And if you really want to be consistent you would probably also want defmulti-, defmacro-, defstruct-, defprotocol-, etc. In my opinion, if defn- is not in core but in contrib, I feel be consistent. By the way, defstruct- and defmacro- is in contrib consistently :-) If we really

Re: Why no def- ?

2011-01-23 Thread Benjamin Teuber
stuart.hallo...@gmail.com wrote: Please don't. It has already been discussed and declined. The metadata is uglier because we want doing this to be slightly ugly.. Sorry, didn't get your response in time.. Anyways, I agree with Ken it seems weird to have defn- in core and not def- - or is defn-

Re: Why no def- ?

2011-01-23 Thread OGINO Masanori
Hello. Sorry to cut in, but I agree with Ken, too. If defn- should be in core and def- shouldn't, it seems asymmetric. Showing why there is asymmetric design may leads to positive discussion, I think. Thank you. -- Name: OGINO Masanori (荻野 雅紀) E-mail: masanori.og...@gmail.com -- You

Re: Why no def- ?

2011-01-22 Thread Benjamin Teuber
I think a def- definitely belongs in core for consistency reasons. So I'm writing a ticket and patch now. Cheers, Benjamin -- 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

Re: Why no def- ?

2011-01-22 Thread Stuart Halloway
Please don't. It has already been discussed and declined. The metadata is uglier because we want doing this to be slightly ugly.. Stu Stuart Halloway Clojure/core http://clojure.com I think a def- definitely belongs in core for consistency reasons. So I'm writing a ticket and patch now.

Re: Why no def- ?

2011-01-22 Thread Ken Wesson
On Sat, Jan 22, 2011 at 10:27 AM, Stuart Halloway stuart.hallo...@gmail.com wrote: Please don't. It has already been discussed and declined. The metadata is uglier because we want doing this to be slightly ugly.. We do? Who is we and why does this we want doing this to be slightly ugly? --

Re: Why no def- ?

2011-01-22 Thread Stuart Halloway
1. You could optionally put a docstring after the value of a normal def -- (def foo 17 seventeen). def has supported an optional doc string since 1.2. I have just updated the wiki and docstring to reflect this. (defn foo Docstring -- works currently [x y] (+ (* x x) y))

Re: Why no def- ?

2011-01-22 Thread Stuart Halloway
Please don't. It has already been discussed and declined. The metadata is uglier because we want doing this to be slightly ugly.. We do? Who is we and why does this we want doing this to be slightly ugly? The Clojure/core team is led by its technical advisors, Rich Hickey and myself. In

Re: Why no def- ?

2011-01-22 Thread Ken Wesson
On Sat, Jan 22, 2011 at 10:39 AM, Stuart Halloway stuart.hallo...@gmail.com wrote: 1. You could optionally put a docstring after the value of a normal   def -- (def foo 17 seventeen). def has supported an optional doc string since 1.2. I have just updated the wiki and docstring to reflect

Re: Why no def- ?

2011-01-22 Thread Ken Wesson
On Sat, Jan 22, 2011 at 10:48 AM, Stuart Halloway stuart.hallo...@gmail.com wrote: Please don't. It has already been discussed and declined. The metadata is uglier because we want doing this to be slightly ugly.. We do? Who is we and why does this we want doing this to be slightly ugly?

Re: Why no def- ?

2011-01-22 Thread Stuart Halloway
Please don't. It has already been discussed and declined. The metadata is uglier because we want doing this to be slightly ugly.. We do? Who is we and why does this we want doing this to be slightly ugly? The Clojure/core team is led by its technical advisors, Rich Hickey and myself.

Re: Why no def- ?

2011-01-22 Thread Ken Wesson
On Sat, Jan 22, 2011 at 11:13 AM, Stuart Halloway stuart.hallo...@gmail.com wrote: Please don't. It has already been discussed and declined. The metadata is uglier because we want doing this to be slightly ugly.. We do? Who is we and why does this we want doing this to be slightly ugly?

Re: Why no def- ?

2011-01-21 Thread Aaron Bedra
On 01/21/2011 12:51 AM, Ken Wesson wrote: On Fri, Jan 21, 2011 at 12:40 AM, Alex Baranosky alexander.barano...@gmail.com wrote: I've wanted to have private defs. For defn, I just us defn-. But there is no def- So I just use: (defmacro def- [name decls] (list* `def (with-meta name

Re: Why no def- ?

2011-01-21 Thread Stuart Sierra
And in Clojure 1.3: (def ^:private foo ...) -Stuart Sierra Clojure/core http://clojure.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 -

Re: Why no def- ?

2011-01-21 Thread Laurent PETIT
2011/1/21 Aaron Bedra aaron.be...@gmail.com On 01/21/2011 12:51 AM, Ken Wesson wrote: On Fri, Jan 21, 2011 at 12:40 AM, Alex Baranosky alexander.barano...@gmail.com wrote: I've wanted to have private defs. For defn, I just us defn-. But there is no def- So I just use: (defmacro

Re: Why no def- ?

2011-01-21 Thread Aaron Bedra
On 01/21/2011 09:22 AM, Laurent PETIT wrote: 2011/1/21 Aaron Bedra aaron.be...@gmail.com mailto:aaron.be...@gmail.com On 01/21/2011 12:51 AM, Ken Wesson wrote: On Fri, Jan 21, 2011 at 12:40 AM, Alex Baranosky alexander.barano...@gmail.com

Re: Why no def- ?

2011-01-21 Thread Ken Wesson
On Fri, Jan 21, 2011 at 9:49 AM, Aaron Bedra aaron.be...@gmail.com wrote: On 01/21/2011 09:22 AM, Laurent PETIT wrote: 2011/1/21 Aaron Bedra aaron.be...@gmail.com On 01/21/2011 12:51 AM, Ken Wesson wrote: On Fri, Jan 21, 2011 at 12:40 AM, Alex Baranosky alexander.barano...@gmail.com  

Re: Why no def- ?

2011-01-21 Thread Sean Corfield
On Fri, Jan 21, 2011 at 12:38 PM, Ken Wesson kwess...@gmail.com wrote: Another thing that could be useful: if the entire s-expression (def ...) or (defn ...) has metadata, merge it in, and if there's more than one meta, merge rather than replace. That's how Clojure 1.3 already works... user=

Why no def- ?

2011-01-20 Thread Alex Baranosky
I've wanted to have private defs. For defn, I just us defn-. But there is no def- So I just use: (defmacro def- [name decls] (list* `def (with-meta name (assoc (meta name) :private true)) decls)) -- You received this message because you are subscribed to the Google Groups Clojure group.

Re: Why no def- ?

2011-01-20 Thread Ken Wesson
On Fri, Jan 21, 2011 at 12:40 AM, Alex Baranosky alexander.barano...@gmail.com wrote: I've wanted to have private defs.  For defn, I just us defn-.  But there is no def- So I just use: (defmacro def- [name decls]     (list* `def (with-meta name (assoc (meta name) :private true)) decls))

Re: why the def of run-jetty looks like defn #^Server run-jetty

2010-08-10 Thread ngocdaothanh
The main usage (at least for me) is avoiding reflection in the context of direct call to a Java method. if you write: (defn foo [x]   (.clone x)) Thank you for the insightful explanation. -- You received this message because you are subscribed to the Google Groups Clojure group. To post

why the def of run-jetty looks like defn #^Server run-jetty

2010-08-09 Thread limux
The follow is the ring's source, and I am a newbie in Clojure. what the defn of run-jetty looks like this form, what's the meaning of #^Server in the defn and let? Thanks in advance. Limux. (defn #^Server run-jetty Serve the given handler according to the options. Options: :configurator

Re: why the def of run-jetty looks like defn #^Server run-jetty

2010-08-09 Thread j-g-faustus
On Aug 9, 8:25 am, limux liumengji...@gmail.com wrote: what's the meaning of #^Server in the defn and let? (defn #^Server run-jetty ...   (let [#^Server s (create-server (dissoc options :configurator))] It's a type hint. In the defn it specifies the type of the return value, in the let it

Re: why the def of run-jetty looks like defn #^Server run-jetty

2010-08-09 Thread limux
I see, heartly thanks, and there is no any words about it in API doc of clojure.org yet! Regards limux. On 8月9日, 下午3时04分, j-g-faustus johannes.fries...@gmail.com wrote: On Aug 9, 8:25 am, limux liumengji...@gmail.com wrote: what's the meaning of #^Server in the defn and let? (defn

Re: why the def of run-jetty looks like defn #^Server run-jetty

2010-08-09 Thread limux
The type hint can be placed on function parameters, let-bound names, var names, and expressions. And it can be placed behind or ahead of them. Isn't it? On 8月9日, 下午3时31分, limux liumengji...@gmail.com wrote: I see, heartly thanks, and there is no any words about it in API doc of clojure.org

Re: why the def of run-jetty looks like defn #^Server run-jetty

2010-08-09 Thread Nicolas Oury
I am not 100% sure, but it seems they are always ahead. (defn ^Bar foo ...) tells that function foo returns something of class Bar. (f ^Bar expr) says that expr is of type Bar. (let [ ^Bar e expr] ... says that e is of type Bar. (Bar can be a class or an interface.) The main usage (at least