How is F#(or C#) going to type checking for this kind of thing ?

My understanding of C#'s new var x = ... is that it cannot be passed around(across function boundary like returning to caller) as class(F#'s type) is a contract between the caller and callee so it cannot be annoymous

By on 2/21/2010 10:54 AM ()

You can perfectly well pass around strongly typed values of anonymous types in C# from method to method, you just can't spell out the type - which means that you have to use type inference (either lambdas, or generics). Since F# type inference is much more pervasive (e.g. it can seamlessly infer function return types), it would seem that this would actually be quite naturally suited to F#.

By on 3/4/2010 12:31 PM ()

You can perfectly well pass around strongly typed values of anonymous types in C# from method to method, you just can't spell out the type - which means that you have to use type inference (either lambdas, or generics). Since F# type inference is much more pervasive (e.g. it can seamlessly infer function return types), it would seem that this would actually be quite naturally suited to F#.

That is something new to me which can be very useful. How do you specific the return type in C# and use it in another function ?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 

(?) foo()

{

  var x = from somewhere select {...}

  return x; // is this valid syntax
}

bar(aType x)

{

  x.? // how do I use x which lets say comes from foo 

}

main()

{

   bar(foo()); // does this work

}
By on 3/4/2010 5:51 PM ()
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