Re: Proposal: libraries should have type hints

2011-11-22 Thread Shantanu Kumar
On Nov 22, 7:30 am, Sean Corfield seancorfi...@gmail.com wrote: On Mon, Nov 21, 2011 at 12:50 PM, Alan Malloy a...@malloys.org wrote: This is way, way faster than using reflection. And all you need in order to remove the duplication is a macro that does the hinting for you: Well, if

Re: Proposal: libraries should have type hints

2011-11-22 Thread Nicolas
Hi ! An interresting point of clojure is that it is dynamically typed. This for a reason. There is a tradeoff in performance but the benefit is that the code is shorter, more expressive and reusable. Type hinting should be exceptionnal and used only in critical areas when you see a huge boost in

Re: Proposal: libraries should have type hints

2011-11-22 Thread Ben Mabey
On 11/21/11 7:50 AM, Ralph wrote: I want to propose that Clojure libraries should be fully type-hinted -- that is, they should be compiled with the *warn-on-reflection* option turned on and type hints place wherever possible. I understand the argument against type-hinting end-user code until a

Re: Proposal: libraries should have type hints

2011-11-22 Thread Tassilo Horn
Nicolas bousque...@gmail.com writes: An interresting point of clojure is that it is dynamically typed. This for a reason. There is a tradeoff in performance but the benefit is that the code is shorter, more expressive and reusable. Type hinting should be exceptionnal and used only in

Re: Proposal: libraries should have type hints

2011-11-22 Thread Bill Robertson
I think there is another reasonable case for a type hint. If you've written a function that is not generic, where one type and only one type will do, then why not add a type hint as a form of documentation if nothing else? On Nov 21, 1:58 pm, Nicolas bousque...@gmail.com wrote: Hi ! An

Proposal: libraries should have type hints

2011-11-21 Thread Ralph
I want to propose that Clojure libraries should be fully type-hinted -- that is, they should be compiled with the *warn-on-reflection* option turned on and type hints place wherever possible. I understand the argument against type-hinting end-user code until a performance problem is demonstrated,

Re: Proposal: libraries should have type hints

2011-11-21 Thread Herwig Hochleitner
In principle you're right. But you have to keep in mind, that type hints actually alter runtime behavior. A hinted call tries to cast its argument into the desired type, possibly resulting in a type cast exception. An unhinted call, on the other hand, just looks for the signature. So in essence

Re: Proposal: libraries should have type hints

2011-11-21 Thread Tassilo Horn
Herwig Hochleitner hhochleit...@gmail.com writes: Hi Herwig, In principle you're right. But you have to keep in mind, that type hints actually alter runtime behavior. A hinted call tries to cast its argument into the desired type, possibly resulting in a type cast exception. An unhinted

Re: Proposal: libraries should have type hints

2011-11-21 Thread Sean Corfield
On Mon, Nov 21, 2011 at 8:12 AM, Tassilo Horn tass...@member.fsf.org wrote: But is that really an issue?  I mean, since you cannot use such duck typing in Java itself (except in terms of reflection), any method defined for more than one class with shared, consistent semantics is declared in

Re: Proposal: libraries should have type hints

2011-11-21 Thread Alan Malloy
On Nov 21, 12:24 pm, Sean Corfield seancorfi...@gmail.com wrote: On Mon, Nov 21, 2011 at 8:12 AM, Tassilo Horn tass...@member.fsf.org wrote: But is that really an issue?  I mean, since you cannot use such duck typing in Java itself (except in terms of reflection), any method defined for

Re: Proposal: libraries should have type hints

2011-11-21 Thread Sean Corfield
On Mon, Nov 21, 2011 at 12:50 PM, Alan Malloy a...@malloys.org wrote: This is way, way faster than using reflection. And all you need in order to remove the duplication is a macro that does the hinting for you: Well, if Clojure/core decide contrib libraries should indeed use conditional code