正文

微软最新语言-visual2010 F#语言2012-01-15 09:26:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/iamben250/53148.html

分享到:

F#是由微软发展的为微软.NET语言提供运行环境的程序设计语言。它是基于Ocaml的,而Ocaml是基于ML函数程序设计语言的。
  这是一个用于显示.NET在不同编程语言间互通的程序设计。
[编辑本段]历史
  F#自2002年开始研发,2005年发布了第一个版本,2007年底正式从研发专案转移至产品部门,并决定将F#置入Visual Studio.NET 2010。截止目前(2009年1月6日),最新的F#预览版为F# September 2008 CTP,版本号为1.9.6.2
[编辑本段]定位
  微软计划将慢慢整合F#至.NET平台并使F#最终成为.NET平台的顶峰语言。
  众所周知,F#是一种函数型程序设计(FP,Functional Programming)语言。然而F#对IP(Imperative Programming)与OOP(Object Oriented Programming)的支持几乎一样的出色。
  F#也许终将成为程序核心部分设计的首选,而C#与VB等将在用户界面交互设计方面继续发挥其强大的潜力。
[编辑本段]展望
  以目前来看,随著FP在程序设计中的重要性日渐凸显,F#身为微软唯一的FP语言,其位置特殊,容易引起关注。
  对一部分人来说,这语言所带来的一些特性以及其对FP的特性的全面支持(而且做得都比较好,至少目前是这样),可能会带来一次大的革变。
[编辑本段]掌握
  目前学习F#的资料并不丰富,而且其文档淩乱琐碎。比较优秀的书籍是(目前似乎是唯一)2005年8月由Apress出版的《Expert F#》,由Syme, Don/ Granicz, Adam/ Cisternino, Antonio合著。
  可以通过查阅MSDN得到一些零散的入门类文档。
[编辑本段]代码示例
  F# Hello Word 程序
  (* This is commented *)
  (* Sample hello world program *)
  printfn "Hello World!"
  F# Winforms 程序
  #light
  (* Sample Windows Forms Program *)
  (* We need to open the Windows Forms library *)
  open System.Windows.Forms
  (* Create a window and set a few properties *)
  let form = new Form(Visible=true, TopMost=true, Text="Welcome to F#")
  (* Create a label to show some text in the form *)
  let label =
  let temp = new Label()
  let x = 3 + (4 * 5)
  (* Set the value of the Text*)
  temp.Text <- sprintf "x = %d" x
  (* Remember to return a value! *)
  temp
  (* Add the label to the form *)
  do form.Controls.Add(label)
  (* Finally, run the form *)
  [<STAThread>]
  do Application.Run(form)

微软官方原文介绍:微软网站原文描述如下:

         F#——Combining the efficiency, scripting, strong typing and productivity of ML with the stability, libraries, cross-language working and tools of .NET.

         F# is a programming language that provides the much sought-after combination of type safety, performance and scripting, with all the advantages of running on a high-quality, well-supported modern runtime system. F# gives you a combination of

         interactive scripting like Python,

         the foundations for an interactive data visualization environment like MATLAB,

         the strong type inference and safety of ML,

         a cross-compiling compatible core shared with the popular OCaml language,

         a performance profile like that of C#,

         easy access to the entire range of powerful .NET libraries and database tools,

         a foundational simplicity with similar roots to Scheme,

         the option of a top-rate Visual Studio integration,

         the experience of a first-class team of language researchers with a track record of delivering high-quality implementations,

         the speed of native code execution on the concurrent, portable, and distributed .NET Framework. 
The only language to provide a combination like this is F# (pronounced FSharp) - a scripted/functional/imperative/object-oriented programming language that is a fantastic basis for many practical scientific, engineering and web-based programming tasks.

         F# is a pragmatically-oriented variant of ML that shares a core language with OCaml. F# programs run on top of the .NET Framework. Unlike other scripting languages it executes at or near the speed of C# and C++, making use of the performance that comes through strong typing. Unlike many statically-typed languages it also supports many dynamic language techniques, such as property discovery and reflection where needed. F# includes extensions for working across languages and for object-oriented programming, and it works seamlessly with other .NET programming languages and tools.

http://hi.baidu.com/lh1985/blog/item/181e69a42e7534fb9052eed3.html


阅读(1904) | 评论(0)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

暂无评论
您需要登录后才能评论,请 登录 或者 注册