Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: [Caml-list] Style question: excessive currying confusion?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Brady Montz <bradym@b...>
Subject: Re: [Caml-list] Style question: excessive currying confusion?
John Prevost <jprevost@panasas.com> writes:

> On 23 Aug 2001, Brady Montz wrote:
> 
> > Suppose I'm reading through someone else's program, and I come across
> > the definition for fun2, and I want to know what it does. I can't even
> > know how many parameters fun2 takes until I refer to the definition of
> > fun1. The confusion is worst when I don't even know I'm confused about
> > the number of args fun2 can take.
> 
> Note that thinking in terms of "number of arguments that fun2 can
> take" may not be what you want to do, in any case.  In a functional
> language, functions are often good "data", and make reasonable return
> values.  Typically, a good API will hide the fact that there's a function
> underneath, though.

I'm willing to believe this.

> Also note that the type of your fun2 (which may or may not be easy for you
> to determine) will quickly reveal that it takes more arguments.
> 
> In general, I tend to write out all the parameters when I don't think
> it'll be clear, when the functional result isn't being treated as a
> "data" result, or when the let restriction would make the function result
> monomorphic otherwise.

Perhaps it just comes down to: the more clearly defined and/or documented
a function is, the easier it is to understand and use. 

-- 
 Brady Montz
 bradym@balestra.org
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr