-
Git finally
After using Git for a few months with GitHub, I am finally loving it and setup Git server using IIS 7 and git-dot-aspx. I finally feel the force is with me now.
Source control is more important and more complicated I thought many years ago. Over the years of programming, I understand more about it. I used cvs, vss, svn, tfs and now finally Git. I have seen many other people's discussions of version control, I also have many discussion with other people. But the views are so different, it is like for a Christian to convince an atheist to believe there is a god. How can you explain someone who love single checkout in vss that multi checkout is better in vss, how can you explain someone who love vss that svn is better, and how can you explain to someone who love svn that Git is the best. I have seen a IT manager said that "I never seen enterprise software can been successfully implemented without exclusive checkout". It is not worthy for such kind of discussion. But semantics remains the same, we just try to get a tool to satisfy our need, make our work more productive, make us in control. But if we don't have that kind of need, or we don't know there is such kind need, or we don't have time to need, it is very hard to accept some new concept. Git is specially designed to make you feel less intelligent than you think you were. Learn it.
-
"this" in javascript
If you don't know javascript is a functional language and you do lots of object oriented programming, the follow code must be very confusing for you.
var name = "Jerry";
-
mutable binding and ref type
We all know that in F#, once you bind a value to an identifier, that the value can not be changed. What does this means? It means the your identifier will be like a read only property, the property return a value that is determined at the time of binding. After binding, the identifier looks like a constant. Mutable makes identifier more like a variable. But actually, it is a property with both getter and setter. Let's look at the following code.
let testMutable = //let mutable temp = 1 let temp = 1 let innerFunction() = printfn "%i" temp () innerFunction
-
How Binding in f# is like in CLR
In c# or clr philosophy, everything is object, object is the horsepower. In f# philosophy, everything is value, function is the horsepower. However f# is implemented in CLR, I am just curious how F# is implement in CLR, so I use reflector to decompile the generated code. However, I don't think reflector is not very accurate here. To really understand , it is better is use ILDASM.exe.
let m1 = 1 // convert to readonly property //public static int m1 //{ // [CompilerGenerated, DebuggerNonUserCode] // get // { // return 1; // } //}
-
Pattern matching shorthand in function definition
Pattern matching is powerful construct in F#, but sometime it is confusing to beginner, below is pattern matching shorthand in function definition. The paramter is implied in the matching pattern, essentially you can rewrite it as below.
let listOfList = [[2; 3; 5]; [7; 11; 13]; [17; 19; 23; 29]]