Channels ▼

Christopher Diggins

Dr. Dobb's Bloggers

Why I am not a fan of F#

January 14, 2010

I have to admit that I do like both C# and functional programming a lot, but I am really not a fan of F#, here's why.

What annoys me about F# is how cryptic the syntax is. Check out the following list of symbols from http://msdn.microsoft.com/en-us/library/dd233228(VS.100).aspx:

 

Symbol or operator

Links

Description

!

Reference Cells (F#)

Computation Expressions (F#)

  • Dereferences a reference cell.

  • After a keyword, indicates a modified version of the keyword's behavior as controlled by a workflow.

"

Literals (F#)

  • Delimits a text string.

#

Compiler Directives (F#)

Flexible Types (F#)

  • Prefixes a preprocessor or compiler directive, such as #light.

  • When used with a type, indicates a flexible type, which refers to a type or any one of its derived types.

$

No more information available.

  • Used internally for certain compiler-generated variable and function names.

%

Arithmetic Operators (F#)

Code Quotations (F#)

  • Computes the integer modulus.

  • Used for splicing quotations.

&

Match Expressions (F#)

  • Computes the address of a mutable value, for use when interoperating with other languages.

  • Used in AND patterns.

&&

Boolean Operators (F#)

  • Computes the Boolean AND operation.

&&&

Bitwise Operators (F#)

  • Computes the bitwise AND operation.

'

Literals (F#)

Automatic Generalization (F#)

  • Delimits a single-character literal.

  • Indicates a generic type parameter.

``...``

No more information available.

  • Delimits an identifier that would otherwise not be a legal identifier, such as a language keyword.

( )

Unit Type (F#)

  • Represents the single value of the unit type.

(...)

Tuples (F#)

Operator Overloading (F#)

  • Indicates the order in which expressions are evaluated.

  • Delimits a tuple.

  • Used in operator definitions.

(*...*)

  • Delimits a comment that could span multiple lines.

(|...|)

Active Patterns (F#)

  • Delimits an active pattern. Also called banana clips.

*

Arithmetic Operators (F#)

Tuples (F#)

Units of Measure (F#)

  • When used as a binary operator, multiplies the left and right sides.

  • In types, indicates pairing in a tuple.

  • Used in units of measure types.

**

Arithmetic Operators (F#)

  • Computes the exponentiation operation (x ** y means x to the power of y).

+

Arithmetic Operators (F#)

  • When used as a binary operator, adds the left and right sides.

  • When used as a unary operator, indicates a positive quantity. (Formally, it produces the same value with the sign unchanged.)

,

Tuples (F#)

  • Separates the elements of a tuple, or type parameters.

-

Arithmetic Operators (F#)

  • When used as a binary operator, subtracts the right side from the left side.

  • When used as a unary operator, performs a negation operation.

->

Functions (F#)

Match Expressions (F#)

  • In function types, delimits arguments and return values.

  • Yields an expression (in sequence expressions); equivalent to the yield keyword.

  • Used in match expressions

.

Members (F#)

Primitive Types (F#)

  • Accesses a member, and separates individual names in a fully qualified name.

  • Specifies a decimal point in floating point numbers.

..

Loops: for...in Expression (F#)

  • Specifies a range.

.. ..

Loops: for...in Expression (F#)

  • Specifies a range together with an increment.

.[...]

Arrays (F#)

  • Accesses an array element.

/

Arithmetic Operators (F#)

Units of Measure (F#)

  • Divides the left side (numerator) by the right side (denominator).

  • Used in units of measure types.

//

  • Indicates the beginning of a single-line comment.

///

XML Documentation (F#)

  • Indicates an XML comment.

:

Functions (F#)

  • In a type annotation, separates a parameter or member name from its type.

::

Lists (F#)

Match Expressions (F#)

  • Creates a list. The element on the left side is appended to the list on the right side.

  • Used in pattern matching to separate the parts of a list.

:=

Reference Cells (F#)

  • Assigns a value to a reference cell.

:>

Casting and Conversions (F#)

  • Converts a type to type that is higher in the hierarchy.

:?

Match Expressions (F#)

  • Returns true if the value matches the specified type; otherwise, returns false (type test operator).

:?>

Casting and Conversions (F#)

  • Converts a type to a type that is lower in the hierarchy.

;

Verbose Syntax (F#)

Lists (F#)

Records (F#)

  • Separates expressions (used mostly in verbose syntax).

  • Separates elements of a list.

  • Separates fields of a record.

<

Arithmetic Operators (F#)

  • Computes the less-than operation.

<<

Functions (F#)

  • Composes two functions in reverse order; the second one is executed first (backward composition operator).

<<<

Bitwise Operators (F#)

  • Shifts bits in the quantity on the left side to the left by the number of bits specified on the right side.

<-

Values (F#)

  • Assigns a value to a variable.

<...>

Automatic Generalization (F#)

  • Delimits type parameters.

<>

Arithmetic Operators (F#)

  • Returns true if the left side is not equal to the right side; otherwise, returns false.

<=

Arithmetic Operators (F#)

  • Returns true if the left side is less than or equal to the right side; otherwise, returns false.

<|

Functions (F#)

  • Passes the result of the expression on the right side to the function on left side (backward pipe operator).

<@...@>

Code Quotations (F#)

  • Delimits a typed code quotation.

<@@...@@>

Code Quotations (F#)

  • Delimits an untyped code quotation.

=

Arithmetic Operators (F#)

  • Returns true if the left side is equal to the right side; otherwise, returns false.

>

Arithmetic Operators (F#)

  • Returns true if the left side is greater than the right side; otherwise, returns false.

>>

Functions (F#)

  • Composes two functions (forward composition operator).

>>>

Bitwise Operators (F#)

  • Shifts bits in the quantity on the left side to the right by the number of places specified on the right side.

>=

Arithmetic Operators (F#)

  • Returns true if the right side is greater than or equal to the left side; otherwise, returns false.

?

Parameters and Arguments (F#)

  • Specifies an optional argument.

  • Used as an operator for dynamic method and property calls. You must provide your own implementation.

? ... <- ...

No more information available.

  • Used as an operator for setting dynamic properties. You must provide your own implementation.

@

Lists (F#)

Strings (F#)

  • Concatenates two lists.

  • When placed before a string literal, indicates that the string is to be interpreted verbatim, with no interpretation of escape characters.

[...]

Lists (F#)

  • Delimits the elements of a list.

[|...|]

Arrays (F#)

  • Delimits the elements of an array.

[<...>]

Attributes (F#)

  • Delimits an attribute.

\

Strings (F#)

  • Escapes the next character; used in character and string literals.

^

Statically Resolved Type Parameters (F#)

Strings (F#)

  • Specifies type parameters that must be resolved at compile time, not at runtime.

  • Concatenates strings.

^^^

Bitwise Operators (F#)

  • Computes the bitwise exclusive OR operation.

_

Match Expressions (F#)

Generics (F#)

  • Indicates a wildcard pattern.

  • Specifies an anonymous generic parameter.

`

Automatic Generalization (F#)

  • Used internally to indicate a generic type parameter.

{...}

Sequences (F#)

Records (F#)

  • Delimits sequence expressions and computation expressions.

  • Used in record definitions.

|

Match Expressions (F#)

  • Delimits individual match cases, individual discriminated union cases, and enumeration values.

||

Boolean Operators (F#)

  • Computes the Boolean OR operation.

|||

Bitwise Operators (F#)

  • Computes the bitwise OR operation.

|>

Functions (F#)

  • Passes the result of the left side to the function on the right side (forward pipe operator).

~~

Operator Overloading (F#)

  • Used to declare an overload for the unary negation operator.

~~~

Bitwise Operators (F#)

  • Computes the bitwise NOT operation.

~-

Operator Overloading (F#)

  • Used to declare an overload for the unary minus operator.

~+

Operator Overloading (F#)

  • Used to declare an overload for the unary plus operator.

Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.
 


Video