Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

F# programming language

10 views
Skip to first unread message

Jon Harrop

unread,
Nov 23, 2006, 5:13:03 AM11/23/06
to

Microsoft Research are developing a functional programming language called
F# for .NET and I've been playing with it recently. I've uploaded some
demos here:

http://www.ffconsultancy.com/dotnet/fsharp/

I'm keen to see what Windows developers think of this language as we're
considering using it to develop commercial applications on the Windows
platform.

--
Dr Jon D Harrop, Flying Frog Consultancy
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists

Christopher Ireland

unread,
Nov 23, 2006, 6:41:56 AM11/23/06
to
"Jon Harrop" <j...@ffconsultancy.com> wrote in message
news:456574ea$0$8713$ed26...@ptn-nntp-reader02.plus.net...

>
> Microsoft Research are developing a functional programming language called
> F# for .NET and I've been playing with it recently. I've uploaded some
> demos here:
>
> http://www.ffconsultancy.com/dotnet/fsharp/
>
> I'm keen to see what Windows developers think of this language as we're
> considering using it to develop commercial applications on the Windows
> platform.

F# does seem to fit in better with XAML, conceptually speaking.

Nice examples, although raytracer.fs does not compile under FSharp-1.1.12.5.

Cheers!

Chris.

Jon Harrop

unread,
Nov 23, 2006, 7:07:57 AM11/23/06
to
Christopher Ireland wrote:
> F# does seem to fit in better with XAML, conceptually speaking.

What is XAML good for? I've seen the demo where they say "you don't have to
write code", then they write a load of code in XML and get a window filled
with RSS feed. Does anyone have any better demos of this technology?

I'm a scientist by trade and know virtually nothing about "web programming"
but I'm very interested in learning about it.

> Nice examples, although raytracer.fs does not compile under
> FSharp-1.1.12.5.

Yeah, I'm on a prerelease 1.1.13.2 which should become publically available
this week. It adds some cool features like comprehensions for lists, arrays
and IEnumerables.

Christopher Ireland

unread,
Nov 23, 2006, 7:31:50 AM11/23/06
to
"Jon Harrop" <j...@ffconsultancy.com> wrote in message
news:45658fdb$0$8720$ed26...@ptn-nntp-reader02.plus.net...

> Christopher Ireland wrote:
>> F# does seem to fit in better with XAML, conceptually speaking.
>
> What is XAML good for? I've seen the demo where they say "you don't have
> to
> write code", then they write a load of code in XML and get a window filled
> with RSS feed. Does anyone have any better demos of this technology?
>
> I'm a scientist by trade and know virtually nothing about "web
> programming"
> but I'm very interested in learning about it.

I don't think it's just about "web programming". Have a look at this
article:
http://www.informit.com/discussion/index.asp?postid=3ba7dd28-5c97-416b-8179-11fef74b617e&rl=1

I get the impression that is to be used XAML as a functional/declarative
language to enable XML-based documents to become self-describing
applications.

>> Nice examples, although raytracer.fs does not compile under
>> FSharp-1.1.12.5.
>
> Yeah, I'm on a prerelease 1.1.13.2 which should become publically
> available
> this week. It adds some cool features like comprehensions for lists,
> arrays
> and IEnumerables.

Nice one!

Cheers!

Chris.


Laurent Bugnion

unread,
Nov 23, 2006, 8:17:51 AM11/23/06
to
Hi,

Christopher Ireland wrote:
> I don't think it's just about "web programming". Have a look at this
> article:
>
http://www.informit.com/discussion/index.asp?postid=3ba7dd28-5c97-416b-8179-11fef74b617e&rl=1

I see XAML as a way to encourage graphics designers and software
developer to work more closely together. Pretty much everything you can
do in XAML, you can also do it in C#. However, people who never
programmed will definitely feel intimidated by the C# environment. XAML
will help, because it can easily be generated by Graphics Design
application (like Expression or Zam 3D), can then easily be modified by
a Graphics Designer (for example, animations, etc...), and then passed
to the software developer for code integration (for example DB
connectivity, web services integration, etc...).

And you're absolutely right, XAML is not thought just for web
programming. In fact, AFAIK, Microsoft sees it more as a replacement for
WinForms than for ASP.NET.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

clintonG

unread,
Nov 23, 2006, 12:06:37 PM11/23/06
to
All this confusion? Its really very simple -- conceptually -- and in fact
simplification of the sublime complexity of logic is the objective. The goal
is to allow line of business analysts who understand the business
initimately to become proficient as application developers. That's all there
is to it for the time being.

This is being accomplished by developing declarative languages that can be
manually edited after or during the use of a push button monkey code
generator. Those who want to know what will come of this trend can (and
probably should) read Isaac Asimov's "Foundation Trilogy" which is the name
his writings were referred to the first couple of times I read these works
in the early 1960s.

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://clintongallagher.metromilwaukee.com/
MAP http://wikimapia.org/#y=43038073&x=-88043838&z=17&l=0&m=h

[1] http://en.wikipedia.org/wiki/The_Foundation_Series


"Laurent Bugnion" <galas...@bluewin.ch> wrote in message
news:%23FrNJHw...@TK2MSFTNGP04.phx.gbl...

Lucian Wischik

unread,
Nov 23, 2006, 12:23:08 PM11/23/06
to
Jon Harrop <j...@ffconsultancy.com> wrote:
>I'm keen to see what Windows developers think of this language as we're
>considering using it to develop commercial applications on the Windows
>platform.

I wrote a recent project in F#: 6,000 lines of code.
But the users required a C# version so I had to rewrite: 30,000 lines
of code to do exactly the same thing.

--
Lucian

Kevin Spencer

unread,
Nov 23, 2006, 12:27:16 PM11/23/06
to
Oops! I MEANT that I always thought F# was A!

;-)

Kevin Spencer
Microsoft MVP
Ministry of Software Development
http://unclechutney.blogspot.com

Never trust a dunderhead with a blunderbuss.


"clintonG" <csgal...@REMOVETHISTEXTmetromilwaukee.com> wrote in message
news:uyGo4GyD...@TK2MSFTNGP02.phx.gbl...


> All this confusion? Its really very simple -- conceptually -- and in fact

<snip>

Kevin Spencer

unread,
Nov 23, 2006, 12:26:07 PM11/23/06
to
Hmmm... I always thought that F# was G!

;-)

Kevin Spencer
Microsoft MVP
Ministry of Software Development
http://unclechutney.blogspot.com

Never trust a dunderhead with a blunderbuss.


"clintonG" <csgal...@REMOVETHISTEXTmetromilwaukee.com> wrote in message
news:uyGo4GyD...@TK2MSFTNGP02.phx.gbl...

> All this confusion? Its really very simple -- conceptually -- and in fact

<snip>

Kevin Spencer

unread,
Nov 23, 2006, 12:28:10 PM11/23/06
to
No, no, no. I was right the first time!

My musical skills are out of practice!

James Crosswell

unread,
Nov 23, 2006, 12:44:47 PM11/23/06
to
Lucian Wischik wrote:
> I wrote a recent project in F#: 6,000 lines of code.
> But the users required a C# version so I had to rewrite: 30,000 lines
> of code to do exactly the same thing.

Wow! I guess it's a program that lent itself to a functional solution
quite nicely. Why would your users care what language it was written in?

Best Regards,

James Crosswell
Microforge.net LLC
http://www.microforge.net

James Crosswell

unread,
Nov 23, 2006, 12:48:08 PM11/23/06
to
Laurent Bugnion wrote:
> And you're absolutely right, XAML is not thought just for web
> programming. In fact, AFAIK, Microsoft sees it more as a replacement for
> WinForms than for ASP.NET.

Indeed, one of the main benefits of XAML is that it separates the code
from the interface (so the coders can work on logic while designers work
on interfaces)... Such separation has existing for web based apps, in
one form or another, for years - so the biggest benefits of XAML are
probably for Windows apps.

Raymond Basque

unread,
Nov 23, 2006, 12:57:33 PM11/23/06
to
Still wrong. F# would be Gb :)


clintonG

unread,
Nov 23, 2006, 1:29:28 PM11/23/06
to
This [1] is even more embarassing.

[1] http://www.rubyclr.com/

"Lucian Wischik" <lu...@wischik.com> wrote in message
news:i3mbm2d12ed14puej...@4ax.com...

Jon Harrop

unread,
Nov 23, 2006, 1:27:12 PM11/23/06
to
James Crosswell wrote:
> Indeed, one of the main benefits of XAML is that it separates the code
> from the interface (so the coders can work on logic while designers work
> on interfaces)... Such separation has existing for web based apps, in
> one form or another, for years - so the biggest benefits of XAML are
> probably for Windows apps.

I'm no expert on this stuff but, from my point of view, if you're trying to
create a technology that makes GUI design easy enough for non-coders then
you need a GUI, not another ASCII language. That's why I don't understand
what hole XAML is supposed to fill.

For one thing, it seems to be a bad programming language (from a language
design point of view), e.g. insufficient static checking. Even in the
14-line demo the author makes a mistake and can't see what is wrong.
Contrast that with Intellisense in a variety of languages...

I've just found another XAML demo here:

http://channel9.msdn.com/showpost.aspx?postid=116327

so I'll watch that and see what they're up to.

clintonG

unread,
Nov 23, 2006, 1:32:09 PM11/23/06
to
Generally speaking, only when using a 12 tone diatonic scale [1]

[1] http://en.wikipedia.org/wiki/Diatonic


"Raymond Basque" <_NOSPAM_rbasque@_NOSPAM_jednm.com> wrote in message
news:eWkcpjyD...@TK2MSFTNGP04.phx.gbl...

James Crosswell

unread,
Nov 23, 2006, 1:44:01 PM11/23/06
to
Jon Harrop wrote:
> I'm no expert on this stuff but, from my point of view, if you're trying to
> create a technology that makes GUI design easy enough for non-coders then
> you need a GUI, not another ASCII language. That's why I don't understand
> what hole XAML is supposed to fill.

You're not actually supposed to write XAML - just like you're not
supposed to manually code gif or jpg files... it's a data format used to
store structures that will typically be designed/modified by design
tools like Sparkle (or whatever they're calling it now).

> For one thing, it seems to be a bad programming language (from a language
> design point of view),

I don't think it is really a programming language... no more than HTML
is a programming language. You create HTML template files for your
ASP.NET programs and the functionality for those GUIs is provided by a
separate piece of the puzzle - i.e. your C#/VB.NET/Chrome or whatever code.

I think you're probably missing the point. Check out some of the demos
on Sparkle on channel9.msdn.com - that gives you a good idea of how
useful XAML can be.

James Crosswell

unread,
Nov 23, 2006, 1:44:59 PM11/23/06
to
clintonG wrote:
> Generally speaking, only when using a 12 tone diatonic scale [1]

Didn't you mention something about simplifying stuff up above ;-)

Jon Harrop

unread,
Nov 23, 2006, 2:01:00 PM11/23/06
to
James Crosswell wrote:
> Wow! I guess it's a program that lent itself to a functional solution
> quite nicely.

That would seem to be most programs. I've written everything from symbolic
maths programs in OCaml that were 100x the code density of C and much
faster to graphical applications (Presenta) that were 4-5x the code density
of C++ and faster.

> Why would your users care what language it was written in?

Especially given that the whole point of a CLR is interoperability. Maybe
they wanted to develop it without any decent developers. ;-)

James Crosswell

unread,
Nov 23, 2006, 3:09:51 PM11/23/06
to
Jon Harrop wrote:
> James Crosswell wrote:
>> Wow! I guess it's a program that lent itself to a functional solution
>> quite nicely.
>
> That would seem to be most programs.

Like a business application that has grids and dialogs to edit
"entities" that are stored in a database? That's what the majority of
applications seem to be... but I fail to see how a functional solution
would reduce the amount of code for these apps. Don't get me wrong, I
think functional programming languages have their applications but just
because you have a hammer doesn't mean that everything else is a nail.

>> Why would your users care what language it was written in?
>
> Especially given that the whole point of a CLR is interoperability. Maybe
> they wanted to develop it without any decent developers. ;-)

Aye, most developers don't get much exposure to functional programming
(outside of their university degrees). It's a slightly different mindset
for sure.

Jon Harrop

unread,
Nov 23, 2006, 4:13:25 PM11/23/06
to
James Crosswell wrote:
> Like a business application that has grids and dialogs to edit
> "entities" that are stored in a database? That's what the majority of
> applications seem to be... but I fail to see how a functional solution
> would reduce the amount of code for these apps.

Sounds like an ideal task for higher-order functions. :-)

> Don't get me wrong, I
> think functional programming languages have their applications but just
> because you have a hammer doesn't mean that everything else is a nail.

Sure. That was based on my own experience, which is mostly science/
graphics/compilers.

Kevin Spencer

unread,
Nov 23, 2006, 5:01:28 PM11/23/06
to
Yes, I realized it while eating my Thanksgiving dinner. I haven't touched a
guitar in 10 years now. Back then I would have known it right off the bat.
I'm so ashamed!

:-(

Kevin Spencer
Microsoft MVP
Ministry of Software Development
http://unclechutney.blogspot.com

Never trust a dunderhead with a blunderbuss.

"clintonG" <csgal...@REMOVETHISTEXTmetromilwaukee.com> wrote in message

news:e6Rfr2yD...@TK2MSFTNGP03.phx.gbl...

Kevin Spencer

unread,
Nov 23, 2006, 5:05:13 PM11/23/06
to
I would think that the greatest benefit of XAML is eXtensibility. Being XML,
it is inherently extensible, platform-independent, and transformable (via
XSL) to virtually any GUI format.

--
HTH,

Kevin Spencer
Microsoft MVP
Ministry of Software Development
http://unclechutney.blogspot.com

Never trust a dunderhead with a blunderbuss.


"James Crosswell" <ja...@microforge.net> wrote in message
news:uWl6tfyD...@TK2MSFTNGP04.phx.gbl...

Christopher Ireland

unread,
Nov 24, 2006, 3:35:24 AM11/24/06
to
Jon Harrop wrote:
| Microsoft Research are developing a functional programming language
| called F# for .NET and I've been playing with it recently. I've
| uploaded some demos here:
|
| http://www.ffconsultancy.com/dotnet/fsharp/
|
| I'm keen to see what Windows developers think of this language as
| we're considering using it to develop commercial applications on the
| Windows platform.

I've just read on Don Syme's blog that you've started a blog of you're own
.. all the best of luck with it!

P.S. it would be great if ray tracer compiled with the latest publicly
available version of F#!

--
Christopher Ireland

"Getting married for sex is like buying a 747 for the free peanuts."
Jeff Foxworthy


Jon Harrop

unread,
Nov 24, 2006, 3:46:50 AM11/24/06
to
Christopher Ireland wrote:
> P.S. it would be great if ray tracer compiled with the latest publicly
> available version of F#!

No, that's a really bad idea. If you can tweak the code then you'll sink an
enormous amount of time into fiddling with it. Take yesterday for example,
I barely got any work done... ;-)

Christopher Ireland

unread,
Nov 24, 2006, 3:58:00 AM11/24/06
to
Jon Harrop wrote:
| Christopher Ireland wrote:
|| P.S. it would be great if ray tracer compiled with the latest
|| publicly available version of F#!
|
| No, that's a really bad idea. If you can tweak the code then you'll
| sink an enormous amount of time into fiddling with it. Take yesterday
| for example, I barely got any work done... ;-)

Out of interest, do you find your code more or less buggy in F# than in C#?
If there is a bug, in which language is it easier to trace and fix?

--
Christopher Ireland

"You can't have everything. Where would you put it?"
Steven Wright


Laurent Bugnion

unread,
Nov 24, 2006, 4:14:55 AM11/24/06
to
Hi,

Kevin Spencer wrote:
> Yes, I realized it while eating my Thanksgiving dinner. I haven't touched a
> guitar in 10 years now. Back then I would have known it right off the bat.
> I'm so ashamed!
>
> :-(
> Kevin Spencer

And now it's on Internet for ever and ever bwahahahaha ;-)

Don't let this spoil your holidays.

Greetings,


Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch

PhotoAlbum: http://www.galasoft-LB.ch/pictures

Lucian Wischik

unread,
Nov 24, 2006, 4:43:42 AM11/24/06
to
"Christopher Ireland" <cire...@gmail.com> wrote:
>Out of interest, do you find your code more or less buggy in F# than in C#?
>If there is a bug, in which language is it easier to trace and fix?

The bugs were of a completely different nature. My F# code ends up
being far more ambitious in scope, far more sophisticated in its data
structures and algorithms, deals with more complex problems. The bugs
I get in it tend to be conceptual ones of algorithm design. My C# code
ends up less ambitious, more "engineery". The bugs I get in it tend to
be normal bugs, like missed initializations or unkept invariants. Also
the C# code never has the same "agility" as F#, the agility to easily
restructure the algorithms and datastructures.

The F# compiler tends to catch more bugs than the C# one does. That's
because it's somehow easier in F# to describe your abstractions in the
type system.

When there are normal bugs in F#, though, they're harder to trace than
C#. I think that's because F# code is more concise and tends to use
"lambdas" a lot more. Consider this F# code:
foldr (fn x y => x+y) 0 mylist;
versus this C# code:
int sum=0;
foreach (int x in mylist)
{ sum+=x;
}
In the C# it's easy to know where to set your breakpoint and where to
run it. In the F# it's not.

--
Lucian

Christopher Ireland

unread,
Nov 24, 2006, 5:36:17 AM11/24/06
to
Lucian Wischik wrote:
| The bugs were of a completely different nature.

That's very interesting, thank you for your insights!

Laurent Bugnion

unread,
Nov 24, 2006, 7:46:15 AM11/24/06
to
Hi,

Lucian Wischik wrote:
> The bugs were of a completely different nature. My F# code ends up
> being far more ambitious in scope, far more sophisticated in its data
> structures and algorithms, deals with more complex problems. The bugs
> I get in it tend to be conceptual ones of algorithm design. My C# code
> ends up less ambitious, more "engineery". The bugs I get in it tend to
> be normal bugs, like missed initializations or unkept invariants. Also
> the C# code never has the same "agility" as F#, the agility to easily
> restructure the algorithms and datastructures.
>
> The F# compiler tends to catch more bugs than the C# one does. That's
> because it's somehow easier in F# to describe your abstractions in the
> type system.
>
> When there are normal bugs in F#, though, they're harder to trace than
> C#. I think that's because F# code is more concise and tends to use
> "lambdas" a lot more. Consider this F# code:
> foldr (fn x y => x+y) 0 mylist;
> versus this C# code:
> int sum=0;
> foreach (int x in mylist)
> { sum+=x;
> }
> In the C# it's easy to know where to set your breakpoint and where to
> run it. In the F# it's not.

Interesting post, thanks for sharing.

One more question though: You mention that C# is more "engineery". Is it
your opinion (like I think after reading what you wrote) that C# is more
targeted at software engineers (like me) and F# at scientists? I got the
feeling that scientists are more able to deal with the abstraction level
you mention, while engineers prefer to see what's going on in the code.

What are your thoughts?

Jon Harrop

unread,
Nov 24, 2006, 10:02:15 AM11/24/06
to
Christopher Ireland wrote:
> Jon Harrop wrote:
> | Christopher Ireland wrote:
> || P.S. it would be great if ray tracer compiled with the latest
> || publicly available version of F#!
> |
> | No, that's a really bad idea. If you can tweak the code then you'll
> | sink an enormous amount of time into fiddling with it. Take yesterday
> | for example, I barely got any work done... ;-)
>
> Out of interest, do you find your code more or less buggy in F# than in
> C#? If there is a bug, in which language is it easier to trace and fix?

I'm coming from a C++ vs ML background, so I can't comment on C# vs F#
specifically. For ML vs C++, I'd say:

1. ML is ~10x more productive, i.e. 1/10th development times.
2. ML has 2-5x higher code density.
3. ML code is much more reliable than C++ code but I can't quantify how
much.

I guess the reliability of ML code is reflected in the development time.

Jon Harrop

unread,
Nov 24, 2006, 10:06:33 AM11/24/06
to
Christopher Ireland wrote:
> If there is a bug, in which language is it easier to trace and fix?

When I started programming in OCaml I found its errors messages mostly very
good but sometimes devilishly obscure. F# is in a similar boat.

However, it only took me 6 months to get more efficient in OCaml programming
than I was in C++, having been programming in C++ for 10 years.

Type inference is the main difference. You rarely declare types in F# code
because the compilers infers them all for you. That is usually great
because you write a lot less code and the code is a lot clearer. However,
when it goes wrong, the error messages can be confusing primarily because
they'll contain the wrong types because the wrong types have been inferred.

I should also mention that, for a large class of problems, F# code tends to
work first time once it is compiled. Aside from good language design, I
don't think there is any logical reason to expect that but it certainly
works. There are examples where F# is less effective at checking your code
but it always seems to remain significantly more effective than the
competition.

Jon Harrop

unread,
Nov 24, 2006, 10:16:39 AM11/24/06
to
Laurent Bugnion wrote:
> One more question though: You mention that C# is more "engineery". Is it
> your opinion (like I think after reading what you wrote) that C# is more
> targeted at software engineers (like me) and F# at scientists?

I'm a scientist and I'd actually have said quite the opposite. F# seems to
be taking leaves from Matlab's book and I consider Matlab to be an
engineer's tool.

There's a lot of overlap between scientists and engineers, of course, and I
think a real killer feature for F# will be a graphical version of the
interactive mode. It is actually really easy to start writing one, you just
replace the pretty printer for a given type with one that pops up a window.

> I got the
> feeling that scientists are more able to deal with the abstraction level
> you mention, while engineers prefer to see what's going on in the code.

We probably need a quiz to answer that. If the engineers in the audience can
understand the comparison I drew between the C++ and OCaml implementations
of my ray tracer then I think they'll be fine with F#:

http://www.ffconsultancy.com/free/ray_tracer/comparison.html

I'll put a similar page up comparing C# and F# implementations if you
like...

Laurent Bugnion

unread,
Nov 24, 2006, 10:33:24 AM11/24/06
to
Hi,

Jon Harrop wrote:
> Laurent Bugnion wrote:
>> One more question though: You mention that C# is more "engineery". Is it
>> your opinion (like I think after reading what you wrote) that C# is more
>> targeted at software engineers (like me) and F# at scientists?
>
> I'm a scientist and I'd actually have said quite the opposite. F# seems to
> be taking leaves from Matlab's book and I consider Matlab to be an
> engineer's tool.

Really? I remember Matlab from my engineer's school day, wouldn't like
to use that to build a product (I mean, something I can actually sell to
someone). It was a great tool to study mathematical transformations and
the like, but when I want something done, I really prefer C#.


> There's a lot of overlap between scientists and engineers, of course, and I
> think a real killer feature for F# will be a graphical version of the
> interactive mode. It is actually really easy to start writing one, you just
> replace the pretty printer for a given type with one that pops up a window.
>
>> I got the
>> feeling that scientists are more able to deal with the abstraction level
>> you mention, while engineers prefer to see what's going on in the code.
>
> We probably need a quiz to answer that. If the engineers in the audience can
> understand the comparison I drew between the C++ and OCaml implementations
> of my ray tracer then I think they'll be fine with F#:
>
> http://www.ffconsultancy.com/free/ray_tracer/comparison.html
>
> I'll put a similar page up comparing C# and F# implementations if you
> like...

That would be nice, but I don't think I will work with F# in the near
future (no time...), so do it only if you really have the time, or if
you gain something from it.

Thanks!

Ben Voigt

unread,
Nov 24, 2006, 10:35:56 AM11/24/06
to

"Jon Harrop" <j...@ffconsultancy.com> wrote in message
news:456574ea$0$8713$ed26...@ptn-nntp-reader02.plus.net...

>
> Microsoft Research are developing a functional programming language called
> F# for .NET and I've been playing with it recently. I've uploaded some
> demos here:
>
> http://www.ffconsultancy.com/dotnet/fsharp/
>
> I'm keen to see what Windows developers think of this language as we're

Useful for math and logic, not so much for GUI stuff which really requires
imperative programming. But .NET will let you call back and forth so use an
appropriate mixture of languages.

> considering using it to develop commercial applications on the Windows
> platform.

Last I checked F# was only available for research with no option for a
commercial license. That could be an insurmountable obstacle.

Christopher Ireland

unread,
Nov 24, 2006, 10:28:23 AM11/24/06
to
"Jon Harrop" <j...@ffconsultancy.com> wrote in message
news:45670d91$0$8741$ed26...@ptn-nntp-reader02.plus.net...

>
> I'll put a similar page up comparing C# and F# implementations if you
> like...

Thanks again for your input, Jon.

Yes please <g>!

Cheers!

Chris.


Lucian Wischik

unread,
Nov 24, 2006, 1:18:11 PM11/24/06
to
Jon Harrop <j...@ffconsultancy.com> wrote:
>Type inference is the main difference. You rarely declare types in F# code
>because the compilers infers them all for you. That is usually great
>because you write a lot less code and the code is a lot clearer. However,
>when it goes wrong, the error messages can be confusing primarily because
>they'll contain the wrong types because the wrong types have been inferred.

The most important F# lesson I learnt: always declare complete types
for my functions! And declare types for any complicated-looking
variables. This habit reduced my type-inference-debugging-time a lot.

--
Lucian

Jon Harrop

unread,
Nov 24, 2006, 1:22:43 PM11/24/06
to
Laurent Bugnion wrote:

> Jon Harrop wrote:
>> I'm a scientist and I'd actually have said quite the opposite. F# seems
>> to be taking leaves from Matlab's book and I consider Matlab to be an
>> engineer's tool.
>
> Really? I remember Matlab from my engineer's school day, wouldn't like
> to use that to build a product (I mean, something I can actually sell to
> someone). It was a great tool to study mathematical transformations and
> the like, but when I want something done, I really prefer C#.

You wouldn't use Matlab to make an application but you might write a toolbox
for Matlab and sell it. I think it is possible to do the same thing for F#
but, at the same time, you can write your applications in F# instead of C#.

Jon Harrop

unread,
Nov 24, 2006, 1:29:28 PM11/24/06
to
Ben Voigt wrote:
> "Jon Harrop" <j...@ffconsultancy.com> wrote in message
> news:456574ea$0$8713$ed26...@ptn-nntp-reader02.plus.net...
>> Microsoft Research are developing a functional programming language
>> called F# for .NET and I've been playing with it recently. I've uploaded
>> some demos here:
>>
>> http://www.ffconsultancy.com/dotnet/fsharp/
>>
>> I'm keen to see what Windows developers think of this language as we're
>
> Useful for math and logic, not so much for GUI stuff which really requires
> imperative programming.

I'm going to try to write some GUI programs and I'll see how F# compares.
Presumably C# is likely to come out on top when there is a big GUI and not
much under the hood?

> But .NET will let you call back and forth so use
> an appropriate mixture of languages.

I've obviously been writing F# code that calls C# APIs but I've yet to try
it the other way around. I assume you have to restrict yourself to the C#
subset of F# when you want your F# code to be callable from C#.

Potentially I could write code in F# and sell it as a DLL for other .NET
programmers to use and they would never even know that I wrote it in F#.
I'd like try that but I've no idea if it is feasible... :-)

>> considering using it to develop commercial applications on the Windows
>> platform.
>
> Last I checked F# was only available for research with no option for a
> commercial license. That could be an insurmountable obstacle.

I'm sure you can write commercial software in F# and sell it. I think the
author is trying to get the whole thing released under a commercial license
so you will even be able to bundle the F# compiler with your product, e.g.
to do metaprogramming.

Christopher Ireland

unread,
Nov 24, 2006, 1:42:59 PM11/24/06
to
"Jon Harrop" <j...@ffconsultancy.com> wrote in message
news:45673ac1$0$8712$ed26...@ptn-nntp-reader02.plus.net...

> I've obviously been writing F# code that calls C# APIs but I've yet to try
> it the other way around. I assume you have to restrict yourself to the C#
> subset of F# when you want your F# code to be callable from C#.

I think it must be, given that the assemblies built from F# are MSIL.

Try downloading Reflector for .NET (http://www.aisto.com/roeder/dotnet/) and
opening your raytracer.exe .. you'll be able to see the whole thing in C#
(or even Delphi, for that matter <g>).

Cheers!

Chris.


Lucian Wischik

unread,
Nov 24, 2006, 2:00:57 PM11/24/06
to
Laurent Bugnion <galas...@bluewin.ch> wrote:
>One more question though: You mention that C# is more "engineery". Is it
>your opinion (like I think after reading what you wrote) that C# is more
>targeted at software engineers (like me) and F# at scientists?

We're called software engineers but I don't think there's very much
engineering discipline in our work. We're expected to produce lots of
features, quickly, and track down lots of bugs, and we often don't
even have the time to sit back and calmly document how what we've done
works. F# seems good for this audience.

--
Lucian

Laurent Bugnion

unread,
Nov 24, 2006, 3:36:30 PM11/24/06
to
Hi,

I am lucky enough to work for Siemens, where software engineers are
engineers ;-) We do a lot of architecture and design, for example.

Also, note that in Switzerland, you can only use the title software
engineer if you are really an engineer. In my case, I did an engineer
school in electricity and electronics before I made a postgrade study in
software. Non-engineers who followed the same postgrade are not allowed
to use the title software engineer.

Christopher Ireland

unread,
Nov 25, 2006, 10:46:28 AM11/25/06
to
"Laurent Bugnion" <galas...@bluewin.ch> wrote in message
news:eT%23H7gAE...@TK2MSFTNGP03.phx.gbl...

> Also, note that in Switzerland, you can only use the title software
> engineer if you are really an engineer. In my case, I did an engineer
> school in electricity and electronics before I made a postgrade study in
> software. Non-engineers who followed the same postgrade are not allowed to
> use the title software engineer.

No duck typing in Switzerland, then!

;-)

Cheers!

Chris.


Lebesgue

unread,
Nov 25, 2006, 5:17:33 PM11/25/06
to
>> Useful for math and logic, not so much for GUI stuff which really
>> requires
>> imperative programming.
>
> I'm going to try to write some GUI programs and I'll see how F# compares.
> Presumably C# is likely to come out on top when there is a big GUI and not
> much under the hood?

Just a side note: One can use F# to write ASP.NET applications:
http://cs.hubfs.net/blogs/tomasp/archive/2006/08/13/475.aspx
Project page: http://www.codeplex.com/fscodedom


Jon Harrop

unread,
Dec 2, 2006, 10:28:54 PM12/2/06
to
Christopher Ireland wrote:
> P.S. it would be great if ray tracer compiled with the latest publicly
> available version of F#!

A new version of F# has just come out that can compile my ray tracer! :-)

0 new messages