From: Scott McKay
Subject: Distributed higher-order functions
Date: 
Message-ID: <xjVA7.143643$vq.33358185@typhoon.ne.mediaone.net>
This is a follow-on to my questions about distributed objects
vs. generic functions.  The next several paragraphs summarize what I
learned so that I can ask the questions at the very end of the message.

It now seems that systems like EJB address two distinct things:
 - Distribution of objects
 - "Packaging" of the functions you can call on the objects
These are conflated in Java/EJB (which is what got me started on this)
because Java classes conflate the concepts.

Java/EJB uses EJB classes in both ways: "entity beans" are the
persistent objects (but also exist for their packaging), and "session
beans" (that exist only for their packaging).  Interestingly, EJB has
two kinds of session beans:
 - Stateless
 - Stateful, in which state can persist across multiple calls to
   functions in the bean

Now that I roughly understand EJB, I am dissatisfied with the solution
because it seems to "imperative" and "side- effecty".  For example, if
you have some "business logic" that needs to compute the average price
of some stuff (which stuff is provided by a bean class written by
someone else), you have to get all of the objects, ship `em over the
next, just so you can sum the prices.  OK, that's not side-effecty, but
I would sure rather be able to ship
 #'(lambda (coll) (reduce #'+ coll :key #'price :initial-value 0))
to a 'do-things' method on my bean class, and have the work done
entirely in the bean without have to marshall up and move 132,454 prices
over my network.

Some people chimed in with the idea of distributing generic functions
(but note that I think that misses the packaging up of functionality
provided by class-based distribution).  Someone else pointed me a Java
Spaces, which are an extension of the Linda ideas, which I knew nothing
about until 5 days ago.  Thanks for these pointers; they were fruitful,
tho' I haven't yet got my head around Linda and Java Spaces completely.

With all the above in mind, I had a small realization:
 - An entity bean really is a distributed instance of a user class that
   provides (or can provide) persistence (i.e., storage in a database)
   and packaging for a bunch of methods on the object.  The EJB notion
   of this is adequate, but something like Lisp or Dylan needs a way to
   provide the packaging.  Sufficient macrology will probably do the
   trick, but I think the people who think this is easy are in for a
   rude surprise.
 - A stateless session bean is a package of related functions that are
   operating in an empty environment.
 - A stateful session bean is a package of related functions that are
   operating in a non-empty empty environment.

Perhaps the session beans can be implemented as a bunch internal
functions within a single top-level function (tho' there is the little
problem that in Lisp/Dylan, internal functions don't do dispatch...)?

At long last, here are my questions.
 - Is anyone aware of any work on distributed higher-order functions?
   (That 'reduce' example above is my motivation.)
 - Has anyone addressed the efficiency issues?
 - Just how hard is it to host Lisp or Dylan on the JVM?  Are there
   small semantic changes to the languages that would make this much
   easier?  What about the new Microsoft VM?

Thanks for your forbearance...

From: Chris Double
Subject: Re: Distributed higher-order functions
Date: 
Message-ID: <wkofmzpiqc.fsf@double.co.nz>
"Scott McKay" <···@mediaone.net> writes:

>  - Is anyone aware of any work on distributed higher-order functions?
>    (That 'reduce' example above is my motivation.)

Maybe not quite what you want but Kali Scheme is a distributed scheme:

  "Kali Scheme is a distributed implementation of Scheme that permits
  efficient transmission of higher-order objects such as closures and
  continuations"

  http://www.neci.nj.nec.com/PLS/Kali.html

Erlang also has much functionality for distributed computing in a
functional manner:

  http://www.erlang.org

A mobile agents framework using Scheme is Tube:

  http://www.cl.cam.ac.uk/Research/SRG/opera/people/dah28/position-final/position-final.html

>  - Just how hard is it to host Lisp or Dylan on the JVM?  

Kawa is a full Scheme implementation sitting on top of the JVM. If
that can be done then I'm sure Dylan can be done:

  http://www.gnu.org/software/kawa/

SmallScript has some of the features of Dylan/Lisp. Including
multimethod dispatch. It's available on its own .NET style engine
called AOS as well as .NET. I don't think it's available just yet. I
heard something about late October. But details on it are at:

  http://www.smallscript.org

I'm sure some of the problems that the author of that environment had
getting things going on .NET would match the types of problems faced
by Dylan/Lisp.

Chris.
-- 
http://www.double.co.nz/dylan
From: Neelakantan Krishnaswami
Subject: Re: Distributed higher-order functions
Date: 
Message-ID: <slrn9t9728.9rr.neelk@brick.cswv.com>
On 23 Oct 2001 08:39:23 +1300, Chris Double <·····@double.co.nz> wrote:
>
>Maybe not quite what you want but Kali Scheme is a distributed scheme:
>
>  "Kali Scheme is a distributed implementation of Scheme that permits
>  efficient transmission of higher-order objects such as closures and
>  continuations"
>
>  http://www.neci.nj.nec.com/PLS/Kali.html

Another distributed Scheme is Matthew Fuch's Dreme:

  http://www.cs.nyu.edu/phd_students/fuchs/

I sent this next in email to Scott, but Luca Cardelli wrote a paper
describing a language with distributed higher order functions:

  Obliq: A language with distributed scope.
  http://www.luca.demon.co.uk/Papers.html#ObliqPaper

He's also done a lot of more recent work on "ambients," which is a
kind of process calculus with types to express various facets of
concurrent and distributed computation. It's neat stuff.


Neel
From: Olivier Lefevre
Subject: Re: Distributed higher-order functions
Date: 
Message-ID: <3bdc10d3@news.core.genedata.com>
> I sent this next in email to Scott, but Luca Cardelli wrote a paper
> describing a language with distributed higher order functions:
>
>   Obliq: A language with distributed scope.
>   http://www.luca.demon.co.uk/Papers.html#ObliqPaper

He did more than write a paper: Obliq was actually implemented but
the Obliq home page at DEC Research seems to be dead...

-- O.L.