On Apr 30, 2014, at 11:03 AM, Gregg Reynolds <d...@mobileink.com> wrote:
> Controversial:  literate programming is a bad, bad, bad idea.  There is a 
> reason it has never caught on.

I was going to stay out of this discussion but... I agree with Gregg here. All 
that prose just gets in the way and inhibits the largest portion of software 
development: maintenance. Sure, it's great in theory to have all that 
documentation right there when you're first learning a code base, but then it 
just gets in the way - and you're still not guaranteed that any maintenance 
that is done will keep the (extensive) documentation up to date. Most 
programmers just don't work well with prose - neither at reading it nor writing 
it.

I think Clojure's docstrings are a great compromise: something built into the 
language for each "file" (namespace) and each var and function. I wish 
docstrings could be added to some other constructs (defmethod, in particular, 
but also the "pure Java" definterface / defrecord / deftype stuff). Short, 
clear docstrings and well-structured code with well-named symbols short provide 
enough information for maintenance. Rationale, concepts and extensive examples 
belong outside the code for that "first use" scenario, IMO.

> The one thing that I think would be genuinely useful and developer friendly 
> with respect to Clojure is a means of making type signatures explicit.  
> Clojure may be dynamically typed, but everything has an intended type, and I 
> would like to see it.  I'm thinking of something along the way Haskell and 
> other languages express type sigs.  The paradigmatic example is factorial (or 
> fibonacci).  So given a factorial function "fact" I want to be able to write 
> something like (type-sig fact) and get something like "Int -> Int".

Having used core.typed at work, I'll posit that type inference on most Clojure 
code won't actually tell you a lot. The inferred types would be pretty general. 
Even when adding annotations (for core.typed's analysis), it's sometimes 
surprisingly hard to crank down the type signatures and still get everything to 
type check: you often need either much more general types than you might wish 
for or you end up with complex union types, partly due to nil-punning and 
Clojure's view of truthy / falsey.

Sean Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)



Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to