F Sharp (programming language): Difference between revisions

Content deleted Content added
Citation bot (talk | contribs)
Added date. | Use this bot. Report bugs. | Suggested by Whoop whoop pull up | Category:.NET programming languages | #UCB_Category 5/33
Rescuing 2 sources and tagging 0 as dead.) #IABot (v2.0.9.5
 
(7 intermediate revisions by 5 users not shown)
Line 33:
'''F#''' (pronounced '''F sharp''') is a [[General-purpose programming language|general-purpose]], [[High-level programming language|high-level]], [[Strong and weak typing|strongly typed]], [[Programming paradigm#Multi-paradigm|multi-paradigm]] [[programming language]] that encompasses [[functional programming|functional]], [[imperative programming|imperative]], and [[object-oriented programming]] methods. It is most often used as a [[Cross-platform software|cross-platform]] [[Common Language Infrastructure]] (CLI) language on [[.NET]], but can also generate [[JavaScript]]<ref name="js">{{cite web |url=http://fsharp.org/use/web-apps/ |title=Using F# for Web Applications |author=The F# Software Foundation |access-date=2020-07-30}}</ref> and [[graphics processing unit]] (GPU) code.<ref name="gpgpu">{{cite web |url=http://fsharp.org/use/gpu/ |archive-url=https://web.archive.org/web/20191225110926/http://fsharp.org/use/gpu/ |url-status=dead |archive-date=2019-12-25 |title=Using F# for GPU Programming |author=The F# Software Foundation |access-date=2019-12-25}}</ref>
 
F# is developed by the [[F Sharp Software Foundation|F# Software Foundation]],<ref name="fsharporg">{{cite web |url=http://fsharp.org |title=The F# Software Foundation |author=The F# Software Foundation |access-date=2012-11-24}}</ref> [[Microsoft]] and open contributors. An [[Open-source software|open source]], cross-platform compiler for F# is available from the F# Software Foundation.<ref name="fsharposg">{{cite web |url=https://fsharp.github.io/ |title=F# Compiler (open source edition) @ github |author=The F# Software Foundation |access-date=2012-11-24 |archive-date=2013-05-17 |archive-url=https://web.archive.org/web/20130517105109/http://fsharp.github.io/ |url-status=dead }}</ref> F# is a fully supported language in [[Microsoft Visual Studio|Visual Studio]]<ref>{{cite web |url=https://docs.microsoft.com/en-us/visualstudio/ide/fsharp-visual-studio |title=Develop with Visual F# in Visual Studio |access-date=2020-07-30}}</ref> and [[JetBrains#IDEs|JetBrains Rider]].<ref>{{cite web |url=https://www.jetbrains.com/help/rider/F_Sharp.html |title=F# |access-date=2020-07-30}}</ref> [[Plug-in (computing)|Plug-ins]] supporting F# exist for many widely used editors including [[Visual Studio Code]], [[Vim (text editor)|Vim]], and [[Emacs]].
 
F# is a member of the [[ML (programming language)|ML]] language family and originated as a [[.NET Framework]] implementation of a core of the programming language [[OCaml]].<ref name="historyMSR"/><ref name="ocamlOrigins"/> It has also been influenced by [[C Sharp (programming language)|C#]],
Line 134:
[[JavaScript]],<ref name="js"/> [[Graphics processing unit|GPU]]<ref name="gpgpu"/>
| [[.NET]] SDK 8.0.100<ref>{{cite web|title=Download .NET 8.0 (Linux, macOS, and Windows)|url=https://dotnet.microsoft.com/en-us/download/dotnet/8.0|publisher=Microsoft|access-date=November 14, 2023}}</ref>
|-
| 9.0
|
|November 2024<ref>{{Cite web|url=https://learn.microsoft.com/en-us/dotnet/fsharp/whats-new/fsharp-9|title=What's new in F# 9|date=November 12, 2024}}</ref>
|[[Linux]], [[macOS]], [[Microsoft Windows|Windows]],
[[JavaScript]],<ref name="js"/> [[Graphics processing unit|GPU]]<ref name="gpgpu"/>
| [[.NET]] SDK 9.0.0<ref>{{cite web|title=Download .NET 9.0 (Linux, macOS, and Windows)|url=https://dotnet.microsoft.com/en-us/download/dotnet/9.0|publisher=Microsoft|access-date=January 13, 2025}}</ref>
|}
 
Line 144 ⟶ 151:
 
F# originates from Microsoft Research, Cambridge, UK. The language was originally designed and implemented by [[Don Syme]],<ref name="historyMSR">{{cite web |url=https://www.microsoft.com/en-us/research/project/f-at-microsoft-research/ |title=F# Historical Acknowledgements |website=[[Microsoft]]}}</ref> according to whom in the fsharp team, they say the F is for "Fun".<ref>{{cite web |url=http://www.networkworld.com/article/2271225/software/the-a-z-of-programming-languages--f-.html |title=The A-Z of programming languages: F# |last1=Edwards |first1=Kathryn |date=23 December 2008 |website=[[Network World]] |publisher=IDG |access-date=8 August 2016 |archive-date=13 November 2018 |archive-url=https://web.archive.org/web/20181113210720/https://www.networkworld.com/article/2271225/software/the-a-z-of-programming-languages--f-.html |url-status=dead}}</ref>
Andrew Kennedy contributed to the design of [[units of measure]].<ref name="historyMSR"/> The Visual F# Tools for Visual Studio are developed by Microsoft.<ref name="historyMSR"/> The F# Software Foundation developed the F# open-source compiler and tools, incorporating the open-source compiler implementation provided by the Microsoft Visual F# Tools team.<ref name="fsharporg"/>
 
{| class="wikitable"
Line 330 ⟶ 337:
* New diagnostics from the compiler
* Switches for compiler parallelization
|-
! 9.0<ref>{{Cite web|url=https://learn.microsoft.com/en-us/dotnet/fsharp/whats-new/fsharp-9|title=What's new in F# 9| date=12 November 2024}}</ref>
|
* Nullable reference types
* Discriminated union .Is* properties
* Partial active patterns can return bool instead of unit option
* Prefer extension methods to intrinsic properties when arguments are provided
* Empty-bodied computation expressions
* Hash directives are allowed to take non-string arguments
* Extended #help directive in fsi to show documentation in the REPL
* Allow #nowarn to support the FS prefix on error codes to disable warnings
* Warning about TailCall attribute on non-recursive functions or let-bound values
* Enforce attribute targets
* Updates to the standard library (FSharp.Core)
* Developer productivity improvements
* Performance improvements
* Improvements in tooling
|}
 
Line 370 ⟶ 394:
Age : int }
</syntaxhighlight>
Records can be created as {{code|lang=fsharp|code=let r = { Name="AB"; Age=42 } }}. The <code>with</code> keyword is used to create a copy of a record, as in {{code|lang=fsharp|code={ r with Name="CD" } }}, which creates a new record by copying <code>r</code> and changing the value of the <code>Name</code> field (assuming the record created in the last example was named <code>r</code>).
 
A [[tagged union|discriminated union]] type is a [[type-safe]] version of [[union (computer science)|C unions]]. For example,
Line 414 ⟶ 438:
Like other [[Common Language Infrastructure]] (CLI) languages, F# can use CLI types through object-oriented programming.<ref name="overview"/> F# support for object-oriented programming in expressions includes:
* Dot-notation, e.g., {{code|lang=fsharp|code=x.Name}}
* Object expressions, e.g., {{ code|lang=fsharp| code={ new obj() with member x.ToString() = "hello" } }}
* Object construction, e.g., {{code|lang=fsharp|code=new Form()}}
* Type tests, e.g., {{code|lang=fsharp|code=x :? string}}
Line 591 ⟶ 615:
The [https://safe-stack.github.io/ SAFE Stack] is an end-to-end F# stack to develop web applications. It uses [[ASP.NET Core]] on the server side and [https://fable.io Fable] on the client side.<ref>{{Cite web|url=http://fable.io/|title=Fable: JavaScript you can be proud of!|website=fable.io|access-date=2017-12-09}}</ref>
 
An alternativeAlternative end-to-end F# optionoptions isinclude the [[WebSharper]] framework and the Oxpecker framework.<ref name="websharper">{{cite web |url=http://websharper.com |title=WebSharper home |author=Intellifactory |access-date=2012-11-24}}</ref>
 
===Cross-platform app development===
Line 779 ⟶ 803:
{{Wikibooks|F Sharp Programming}}
* {{Official website|https://fsharp.org/}} The F# Software Foundation
* [https://fsharp.github.io The F# Open Source Group at GitHub] {{Webarchive|url=https://web.archive.org/web/20130517105109/http://fsharp.github.io/ |date=2013-05-17 }}
* [https://fsharp.net/ The Visual F# Developer Center] {{Webarchive|url=https://web.archive.org/web/20081119161341/http://www.fsharp.net/ |date=2008-11-19}}
* [https://web.archive.org/web/20121130163443/http://www.tryfsharp.org/ Try F#, for learning F# in a web browser]