706 reputation
38
bio website none
location
age
visits member for 2 years, 4 months
seen Apr 8 at 22:56

Mar
16
awarded  Yearling
Jan
18
comment How to make the transition to functional programming?
"A single, well thought–out discriminated union, together with appropriate pattern matching code, can often be used as a simpler alternative to an object hierarchy." See: When to Use Classes, Unions, Records, and Structures
Dec
17
comment Why not annotate function parameters?
Of course I modify the comments if I modify the code. It's hard to put a good answer in comments. Also I never said the code was messy, I said "it makes the code look messier".
Dec
17
comment Why not annotate function parameters?
Another reason I don't add just the generic signature to the function definition is that it makes the code look messier. Also adding the generic types typically does not really help in understanding the function as you have to keep the specific type definition in your head to really understand the function in context. When working with many functions its just not easy and is why I use the comments as I did. It's a personal preference. The more I work with F# the more I prefer to leave out the types in the definition. It's an acquired taste but once you acquire it you really to prefer it.
Dec
17
comment Why not annotate function parameters?
I agree that having the definition with the types explicitly defined can help when refactoring, but I find that unit testing can also solve this problem and because I believe that unit test should be used with functional programming to ensure a function works as designed before using the function with another function, this allows me to leave the types out of the definition and have the confidence that if I make a breaking change it will be caught. Example
Dec
17
comment Why not annotate function parameters?
If these comments answer what you are asking let me know so I can move them into the answer.
Dec
17
comment Why not annotate function parameters?
In the long run the way I show them as comments worked for everyone once the code was working. When I start writing a function I put in the types. Once I have the function working, I move the type signature to a comment and remove as many of the types as possible. Some times with F# you need to leave in the type to help the inferencing. For a while I was experimenting with creating the comment with the let and = so that you could uncomment the line for testing, then comment it again when done, but they looked silly and adding a let and = is not that hard.
Dec
17
comment Why not annotate function parameters?
@svick I don't understand your question. Do you mean that I left the types out of the function definition, but could have added the generic types to the function definitions since the generic types would not change the meaning of the function? If so the reason is more of a personal preference. When I first started with F# I did add them. When I started working with more advanced users of F# they preferred them to be left as comments because it was easier to modify the code without the signatures there. ...
Dec
16
answered Why not annotate function parameters?
Dec
11
answered How do I approach a serious F# project without C# knowledge?
Nov
27
answered Theoretical basis for (Linux) kernel development
Jul
16
comment Why Aren't Rule Engines Written In Prolog?
What are you using for the definition of rule engine. If you expand to include term rewriting, then you get into a lot more applications, and if you take the REPL off Prolog to leave unification + back chaining, then you can get into lots of other things including type inferencing in functional languages. So where are you drawing the line with your definition of rule engine.
Apr
18
answered Moving past the ignoring or considering whitespace binary: how should I compare files for e.g. commit review?
Mar
25
awarded  Enthusiast
Mar
16
awarded  Custodian
Mar
16
awarded  Yearling
Mar
7
comment Is memory management in programming becoming an irrelevant concern?
+1 for noting scale. Take a look at this article to really apprecaite resource management in the large scale.
Mar
6
answered How many are too many nested function calls?
Feb
19
awarded  Caucus
Feb
13
comment Why do code generators always use fully-qualified identifiers?
@RobertHarvey He asked about generated code not people created code. From the code geneation that I have done it is also easier to leave in the full qualifiers than it is to factor out the using statements and reduce. But the reason you leave it in is to avoid the collisons with the names.