Content deleted Content added
Jerryobject (talk | contribs) WP:LINKs: update-standardizes, adds. |
Rescuing 2 sources and tagging 0 as dead.) #IABot (v2.0.9.5 |
||
(13 intermediate revisions by 11 users not shown) | |||
Line 6:
| logo = F Sharp logo.svg
| logo size = 128px
| logo caption =
| paradigms = [[Programming paradigm#Multi-paradigm|Multi-paradigm]]: [[functional programming|functional]], [[imperative programming|imperative]], [[object-oriented programming|object-oriented]], [[agent-oriented programming|agent-oriented]], [[metaprogramming]], [[Reflective programming|reflective]], [[concurrent programming|concurrent]]
| family = [[ML (programming language)|ML]]: [[Caml]]: [[OCaml]]
Line 12:
| developer = [[Microsoft]], [[F Sharp Software Foundation|The F# Software Foundation]]
| released = {{Start date and age|2005}}, version 1.0
| latest_release_version = {{wikidata|property|reference|edit| Q648619 |P348}}
|
| latest preview version =
| latest preview date =
| typing = [[Static typing|Static]], [[Strong and weak typing|strong]], [[Type inference|inferred]]
| implementations =
Line 25:
| license = [[MIT License|MIT]]<ref>{{cite web |url=https://github.com/fsharp/fsharp/blob/master/License.txt |title=F# Software Foundation's License |website=[[GitHub]] |date=14 October 2021}}</ref><ref>{{cite web |url=https://github.com/Microsoft/visualfsharp/blob/master/License.txt |title=Microsoft's F# License |website=[[GitHub]] |date=16 October 2021}}</ref>
| website = {{URL|https://fsharp.org/}}
{{URL|https://learn.microsoft.com/en-us/dotnet/fsharp}}
| wikibooks = F Sharp Programming
| file ext = .fs, .fsi, .fsx, .fsscript
Line 30 ⟶ 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 66 ⟶ 69:
| 3.1
| [http://fsharp.org/specs/language-spec/index.html#f-31 November 2013]
| October 2013<ref>{{cite web|title=Visual Studio 2013 released to web|date=17 October 2013 |url=http://blogs.msdn.com/b/visualstudio/archive/2013/10/17/visual-studio-2013-released-to-web.aspx|publisher=Microsoft|access-date=September 7, 2014}}</ref>
|[[Linux]], [[macOS]], [[Microsoft Windows|Windows]];<br/>[[JavaScript]],<ref name="js"/> [[Graphics processing unit|GPU]]<ref name="gpgpu"/>
|[[.NET Framework|.NET]] 2.0 - 4.5, [[Mono (software)|Mono]]
Line 131 ⟶ 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 138 ⟶ 148:
Earlier versions of the F# language were designed by [[Microsoft]] and [[Microsoft Research]] using a closed development process.
F# was first included in Visual Studio in the [[
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]]
Andrew Kennedy contributed to the design of
{| class="wikitable"
|+ Summary of versions
|-
! F#<br/>version
|-
!
|valign="top"|
* Functional programming
Line 163 ⟶ 174:
* Modules (no functors)
* Nested modules
* .NET
|-
!
|
* Active patterns
Line 180 ⟶ 191:
* Computation expressions
|-
!
|
* Type providers
Line 189 ⟶ 200:
* Provided units-of-measure
|-
!
|
* Named union type fields
Line 195 ⟶ 206:
* Type inference enhancements
|-
!
|
* Printf on unitized values
Line 209 ⟶ 220:
* Params dictionaries
|-
!
|
* Struct tuples which inter-operate with C# tuples
Line 223 ⟶ 234:
* Support for 'fixed'
|-
!
|
* Versioning alignment of binary, package, and language
Line 238 ⟶ 249:
* Enumeration cases emitted as public
|-
!
|
* Anonymous record types
|-
!
|
* Implicit yields
Line 250 ⟶ 261:
* Open static classes
|-
!
|
* FSharp.Core now targets netstandard2.0 only
Line 267 ⟶ 278:
* Improved compiler analysis for library authors
|-
!
|
* Tasks
Line 275 ⟶ 286:
* “as” patterns
* Indentation syntax revisions
*
*
* Implicit integer conversions
* First-class support for .NET-style implicit conversions
Line 284 ⟶ 295:
* InlineIfLambda optimizer directive
* Resumable code
*
* Map has Keys and Values
*
*
* Informational warnings for rarely used symbolic operators
|-
!
|
* Static abstract members support in interfaces
Line 305 ⟶ 316:
* Parallel type-checking and project-checking support (experimental, can be enabled via VS setting, or by tooling authors)
* Miscellaneous bugfixes and improvements.
|-
!
|
* _.Property shorthand for (fun x -> x.Property)
* Nested record field copy and update
* while! (while bang) feature <ref>{{Cite web |url=https://devblogs.microsoft.com/dotnet/simplifying-fsharp-computations-with-the-new-while-keyword/ |title=Simplifying F# computations with the new 'while!' keyword' |
* Extended string interpolation syntax
* Use and compose string literals for printf and related functions
* Arithmetic operators in literals
* Type constraint intersection syntax
* Extended fixed binding
* Easier [<Extension>] method definition
* Static members in interfaces
* Static let in discriminated unions, records, structs, and types without primary constructors
* try-with
* Recursive calls and yield! within exception handler
* Tail call attribute
* [<Struct>] unions can now have > 49 cases
* Strict indentation rules
* 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 371 ⟶ 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 415 ⟶ 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 592 ⟶ 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>
===Cross-platform app development===
F# can be used together with the [https://visualstudio.microsoft.com/xamarin/ Visual Studio Tools for Xamarin] to develop apps for [[iOS]] and [[Android (operating system)|Android]]. The [https://
=== Analytical programming ===
Line 780 ⟶ 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]
|