From matthias@cs.rice.edu Sun Mar 14 20:22:53 1999 Received: from cs.rice.edu (cs.rice.edu [128.42.1.30]) by amber.ccs.neu.edu (8.9.1a/8.9.1) with ESMTP id UAA17368; Sun, 14 Mar 1999 20:22:51 -0500 (EST) Received: from africa.cs.rice.edu (africa.cs.rice.edu [128.42.1.175]) by cs.rice.edu (8.9.0/8.9.0) with ESMTP id TAA26745; Sun, 14 Mar 1999 19:22:49 -0600 (CST) Received: (from matthias@localhost) by africa.cs.rice.edu (8.9.0/8.9.0) id TAA09808; Sun, 14 Mar 1999 19:22:48 -0600 (CST) Date: Sun, 14 Mar 1999 19:22:48 -0600 (CST) Message-Id: <199903150122.TAA09808@africa.cs.rice.edu> From: Matthias Felleisen To: lieber@ccs.neu.edu CC: shriram@cs.rice.edu, wand@ccs.neu.edu, dougo@ccs.neu.edu, lieber@ccs.neu.edu, lorenz@ccs.neu.edu, mira@informatik.uni-siegen.de In-reply-to: <199903150054.TAA15342@stockberg.ccs.neu.edu> (message from Karl Lieberherr on Sun, 14 Mar 1999 19:54:54 -0500 (EST)) Subject: Re: adaptive programming Reply-to: matthias@rice.edu References: <199903150054.TAA15342@stockberg.ccs.neu.edu> Status: R Karl, hold the fire. Although Java's syntax is awkward, I claim that Java and (Typed) Scheme are closely related languages. I would point you to a talk I just gave that provides informal evidence for this but it contains one provocative part that I would like to clean up before I release it to the Web. (I gave the talk at Indiana and the strong pro-object-oriented part was (justifiedly) attacked.) Scheme here means RnRS w/o macros. So, what you can do in Java, we can do in Scheme (with one exception) and what we can do in Scheme we can show you in Java (esp. if it has inner classes). Finally, when we say "functional" we do not mean "no assignment". We mean a particular design strategy for programs that may, on occasion, include an assignment for data structures. Hence, we can embedd your state-ful strategies in our world w/o problem. -- Matthias From matthias@cs.rice.edu Sun Mar 14 21:50:59 1999 Received: from cs.rice.edu (cs.rice.edu [128.42.1.30]) by amber.ccs.neu.edu (8.9.1a/8.9.1) with ESMTP id VAA20098 for ; Sun, 14 Mar 1999 21:50:57 -0500 (EST) Received: from africa.cs.rice.edu (africa.cs.rice.edu [128.42.1.175]) by cs.rice.edu (8.9.0/8.9.0) with ESMTP id UAA28342 for ; Sun, 14 Mar 1999 20:50:52 -0600 (CST) Received: (from matthias@localhost) by africa.cs.rice.edu (8.9.0/8.9.0) id UAA09873; Sun, 14 Mar 1999 20:50:51 -0600 (CST) Date: Sun, 14 Mar 1999 20:50:51 -0600 (CST) Message-Id: <199903150250.UAA09873@africa.cs.rice.edu> From: Matthias Felleisen To: lieber@ccs.neu.edu In-reply-to: <199903150201.VAA15426@stockberg.ccs.neu.edu> (message from Karl Lieberherr on Sun, 14 Mar 1999 21:01:00 -0500 (EST)) Subject: Re: adaptive programming Reply-to: matthias@rice.edu References: <199903150201.VAA15426@stockberg.ccs.neu.edu> Status: R Hold it -- inner classes only help with the syntax when you go from Scheme to Java. The useful cases are curried functions (i.e. when a function returns a function) and that does occur in practical traversals a lot. So I am not surprised that you find it useful for appc. -- Matthias From lieber@ccs.neu.edu Sun Mar 14 21:01:03 1999 Received: from stockberg.ccs.neu.edu (lieber@stockberg.ccs.neu.edu [129.10.116.114]) by amber.ccs.neu.edu (8.9.1a/8.9.1) with ESMTP id VAA18661; Sun, 14 Mar 1999 21:01:01 -0500 (EST) Received: (from lieber@localhost) by stockberg.ccs.neu.edu (8.9.1a/8.9.1) id VAA15426; Sun, 14 Mar 1999 21:01:00 -0500 (EST) Date: Sun, 14 Mar 1999 21:01:00 -0500 (EST) From: Karl Lieberherr Message-Id: <199903150201.VAA15426@stockberg.ccs.neu.edu> To: lieber@ccs.neu.edu, matthias@rice.edu Subject: Re: adaptive programming Cc: dougo@ccs.neu.edu, johan@ccs.neu.edu, lorenz@ccs.neu.edu, mira@informatik.uni-siegen.de, shriram@cs.rice.edu, wand@ccs.neu.edu Status: R Hi Matthias: I would like to get the URL of your talk when you release it. Sounds like you have good ways to use inner classes to express various Scheme programming patterns. Mira Mezini has found good ways to use inner classes to implement APPC (see our OOPSLA '98 paper) and their extension, called composents (named by Phil Wadler). -- Karl >From matthias@cs.rice.edu Sun Mar 14 20:22:53 1999 >From: Matthias Felleisen >To: lieber@ccs.neu.edu >CC: shriram@cs.rice.edu, wand@ccs.neu.edu, dougo@ccs.neu.edu, > lieber@ccs.neu.edu, lorenz@ccs.neu.edu, mira@informatik.uni-siegen.de >Subject: Re: adaptive programming >Reply-to: matthias@rice.edu > >Karl, hold the fire. Although Java's syntax is awkward, >I claim that Java and (Typed) Scheme are closely related >languages. I would point you to a talk I just gave that >provides informal evidence for this but it contains one >provocative part that I would like to clean up before I >release it to the Web. (I gave the talk at Indiana and >the strong pro-object-oriented part was (justifiedly) >attacked.) Scheme here means RnRS w/o macros. > >So, what you can do in Java, we can do in Scheme (with >one exception) and what we can do in Scheme we can show >you in Java (esp. if it has inner classes). > >Finally, when we say "functional" we do not mean "no >assignment". We mean a particular design strategy for >programs that may, on occasion, include an assignment for >data structures. Hence, we can embedd your state-ful strategies >in our world w/o problem. > >-- Matthias > From shriram@cs.rice.edu Mon Mar 15 00:10:39 1999 Received: from cs.rice.edu (cs.rice.edu [128.42.1.30]) by amber.ccs.neu.edu (8.9.1a/8.9.1) with ESMTP id AAA24467; Mon, 15 Mar 1999 00:10:28 -0500 (EST) Received: from southamerica.cs.rice.edu (southamerica.cs.rice.edu [128.42.1.195]) by cs.rice.edu (8.9.0/8.9.0) with ESMTP id XAA00517; Sun, 14 Mar 1999 23:09:45 -0600 (CST) Received: (from shriram@localhost) by southamerica.cs.rice.edu (8.9.0/8.9.0) id XAA11341; Sun, 14 Mar 1999 23:09:45 -0600 (CST) Date: Sun, 14 Mar 1999 23:09:45 -0600 (CST) Message-Id: <199903150509.XAA11341@southamerica.cs.rice.edu> From: Shriram Krishnamurthi To: Karl Lieberherr Cc: wand@ccs.neu.edu, dougo@ccs.neu.edu, lorenz@ccs.neu.edu, matthias@cs.rice.edu, mira@informatik.uni-siegen.de Subject: Re: adaptive programming In-Reply-To: <199903150054.TAA15342@stockberg.ccs.neu.edu> References: <199903150054.TAA15342@stockberg.ccs.neu.edu> X-Mailer: VM 6.34 under 20.3 "Vatican City" XEmacs Lucid Reply-To: shriram@cs.rice.edu Mime-Version: 1.0 (generated by tm-edit 7.108) Content-Type: text/plain; charset=US-ASCII Status: R Karl Lieberherr wrote: > In general strategies translate into more general code than just > saying at each node into which parts to traverse. In most cases it > is, indeed, enough to say which parts to traverse but in some cases, > you need to pass an argument to the downward traversals to control > them correctly. It seems easy to pass the argument in your solution. Yes. These are what I call the "downward types". Indeed, the third example in my summary did this: the argument is the depth, which must be incremented before being passed on to the downward traversal. I also described textually how that algorithm could use values more actively (eg, short-circuiting). > Your solution seems to work only for functional languages. [...] I'm not swayed by this claim. Matthias has made some general comments; let me address your specific example. You can probably use overloading to describe "otherwise". (I have in mind Guy Steele's rendering of the pattern of our ECOOP paper into Java.) Otherwise, you need a protocol whereby the actual dispatch is done within the visitor. Since the visitor knows which classes it has methods for, it can invoke an otherwise method for the classes it hasn't explicitly been taught to handle. For hand-written visitors, you could put the dispatcher in an abstract superclass that the visitors must inherit. 'shriram