There are a lot of non-obvious choices to make here. For example:

1
2
3
4
5
6
7
8
 

let inc x = x + 1

let dec y = y - 1

let f = if System.Console.ReadLine().StartsWith("i") then inc else dec

All three functions have type int->int. I guess you'd want the parameter name of "inc" to be "x", and the parameter name of "dec" to be "y", but what of "f"? (Now add XmlDoc comments to the mix and ask the same questions.)

Currying/partial application, as well as anonymous functions, make it hard to come up with great rules here. With methods on the other hand, if you call o.M(x,y), you know that there is a sensible static declaration of M in the program you can use for names and documentation comments.

By on 2/21/2010 11:12 AM ()

Thanks for the explanation, Brian.

I wouldn't expect the tooltip for f to display any argument name. In general, displaying only the names for directly declared arguments of let-bindings would already be super helpful. If additionally names were also displayed for simple partial applications (so that e.g. a name would be displayed for the second argument of g in `let f x y z = ... in let g x = f x 1`) that would already be quite close to the perfect solution, IMHO.

By on 2/22/2010 2:04 AM ()

Hi Brian,

Yes, please add the "easy part" to the automatically generated docs. Even let inc (x:int) = x + 1 doesn't show a parameter name but I think it fits your "easy" pattern.

Regards,
forki

By on 2/22/2010 9:14 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper