F#, Imperative Languages and Identifiers

OMG!  I got pulled off my usual job of doing a bunch of things and have been focused on getting students involved in the Imagine Cup Software Design Invitational in the United States.  Then it was Christmas and I ate to many cookies, etc.  Finally I ignored my one comment from a int19h, and when you get as few comments as I do, everyone is precious!

Int19h ask about my previous blog:

"This is one of the differences between functional programming (F#, OCAML) and imperative  programming (C#, VB.NET, Java), the concept of identifiers is not really supported in the imperative languages, although there are constants.

Can you explain what you mean by "the concept of identifiers is not supported"? Try as I might, I cannot parse this in such a way as to produce some meaning."

Fair enough int19h, just what in the heck was I saying?  Well, if I had wrote my next blog on the day I thought about it, instead of focusing like a laser on getting the students involved with Imagine Cup (hopefully my manager is reading that!).  The concept of the identifier in F# could be explained with this quote from Chris Smith's blog entry,  F# in 20 Minutes:

"...using the term ‘value’ to refer to identifiers rather than ‘variable’.  The reason for this is that types in F# are immutable by default, meaning that once they are created they cannot be changed. This may seem like a severe limitation, but immutability actually prevents some classes of bugs. In addition, immutable data is inherently thread safe meaning you don’t need to worry about sync locks in order to make your code parallelizeable."


What is an "Identifier"?  Identifiers give names to values in F# for reference later in a program.  You would use the keyword 'let', in the following manner, no semi-colon:

let x = 15

When a value is assigned to an identifier, it never changes in a functional program. The style is to refer to this construct as identifiers and not variables, see the book "Foundations of F#", by Robert Pickering.

Functions and Values in F# are treated exactly the same, also, functions in F# supports passing less arguments than the function supports, which is referred to as partial or curried functions.   For more information on this see  this excellent Podwyski's blog entry.


Are you interested in loading up F# and Visual Studio  but don't want to buy or load the full version of Visual Studio?  This is a great way to learn about the Visual Studio Shell and to get started with F#, if you have VS Pro or VS team system, then you only need to load up F#, unless you want to add Visual Studio Shell to your development tools, go ahead and load it.

First download and install the Visual Studio Shell:

Microsoft Visual Studio 2008 Shell (integrated mode) Redistributable Package

Then download and install F# CTP:

Microsoft F#, September 2008 Community Technology Preview

Have fun, make sure to check out the various blogs out there, so much good stuff, so little time!