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
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.
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.
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.
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
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...
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
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
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>
My musical skills are out of practice!
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
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.
<%= 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
"Lucian Wischik" <lu...@wischik.com> wrote in message
news:i3mbm2d12ed14puej...@4ax.com...
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.
<%= 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/Diatonic
"Raymond Basque" <_NOSPAM_rbasque@_NOSPAM_jednm.com> wrote in message
news:eWkcpjyD...@TK2MSFTNGP04.phx.gbl...
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.
Didn't you mention something about simplifying stuff up above ;-)
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. ;-)
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.
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
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...
--
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...
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
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
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
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
That's very interesting, thank you for your insights!
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?
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.
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.
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...
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!
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.
Thanks again for your input, Jon.
Yes please <g>!
Cheers!
Chris.
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
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#.
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.
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.
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
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.
No duck typing in Switzerland, then!
;-)
Cheers!
Chris.
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
A new version of F# has just come out that can compile my ray tracer! :-)