Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion what is functional?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post will appear after it is approved by moderators
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Robert Smart  
View profile  
 More options Nov 14 2007, 5:14 pm
From: "Robert Smart" <robert.kenneth.sm...@gmail.com>
Date: Thu, 15 Nov 2007 09:14:33 +1100
Local: Wed, Nov 14 2007 5:14 pm
Subject: what is functional?
The most important distinction is between descriptive and prescriptive.

A descriptive language describes the result to be computed and leaves
it up to the compiler to work out how to do it. This is often termed
"lazy" since one simple option for the compiler is to put off
computing things till really needed. Also the semantics of descriptive
languages typically require that nothing bad will happen if an
infinite (or failing) intermediate result is described as long as
there is no need to compute all of it. I think a descriptive language
has to be functional. Haskell is the relevant example.

A prescriptive language describes exactly how a result will be
calculated in a sequence of steps. Erlang is in this category, so it
is much easier for the traditional C/java programmer to get into. .

Scala can swing either way. However currently its libraries are
java-like or erlang-like. There is a wonderful series of blog postings
on how to monadify scala which points the way to writing scala
programs in the descriptive style: http://james-iry.blogspot.com/.

Descriptive style means using monads (or something moderately
equivalent) for interacting with external changing state. The whole
point of these is to restrict the compiler's options for
reorganization. Of course if it was done perfectly it would restrict
as much as necessary but no more. However I suspect that descriptive
compilers are going to have to learn to go through the same
optimization tricks as prescriptive languages to be really efficient
for dealing with monads: i.e. they will have to look at monadic
sequences of operations and say "the author wants these things done in
sequence but I can see that it can be reorganized without loss". I'd
love to hear that I'm wrong on this.

Still the main thing that seems to be relevant to efficiency for web
frameworks is a good system for efficiently fielding a large number of
very small communicating processes, as we see in Erlang and
(partially?) recreated with Scala actors. So a key step to moving to a
more descriptive style would seem to be introduce something like that
to haskell or monadified scala. Not that I am competent to make any
suggestions on how to do that.

The other distinctive "functional" common feature of erlang, haskell
and scala is pattern matching. This make for a nice programming style,
but I'm not sure if there is any deep significance?

Bob


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google