-
The design principle of viaProxy
[update: the library is now in github, and the sample code discussed in this post is here]
viaProxy is a client side JavaScript library that can be used to build complex, fast and fluid web UI yet in a manageable code complexity. It is a set of low-level api which is built on top of jQuery and enable you to synchronize your view and model using imperative programming (code only) or declarative programming ( mark-up only) or both. You can use it to write testable views, modules, plugins, and aggregate them into complex view.
-
f# essential - part 14 - object oriented without class
JavaScript is duck type language, if you expect a object has a method, you just call object.method. It supports Polymorphism very well, but you don't need implementation inheritance, and you don't need prototype, constructor at all. F#'s record type has similar concept. It is not a class, but it is strongly type, and it is super easy to create, it is like javascript object in strongly type. I think it is the one of best features in F#. Its syntax is as following
type YourRecordType = { member1: type1; member2: type2 } -
f# essential - part 13 - pattern matching over .net type
f# use unique syntax to match type like the following,
let divide1 x y = try Some (x / y) with | :? System.DivideByZeroException -> printfn "Division by zero!"; None -
f# essential - part 12 - function is not method, is not delegate, what is it anyway
As previous post discussed, f# function is not a method, because it support closure, it curry and so on, and .net method does not support these. It looks very much like a delegate (aka lambda, anonymous method) in .net. For example, the following looks like it is a delegate.
open System open System.Linq
-
f# essential - part 11 - ignore function
If you call a function which does not return unit type, you can not call it like the following.
let f1() = //do some side effect stuff "f1" f1()You have to do the following
f1() |> ignore //or let _ = f1()