RE: Porting to Java using Garden Point Compiler

From: [at]} <skulski{>
Date: Wed, 17 Nov 2004 13:21:15 -0500 (EST)

----boundary-LibPST-iamunique-829395378_-_-
Content-type: text/plain

How about the following. I typed this right now so not sure if this is all
correct, but gives you a flavor. IMHO this is an illustration why
procedure types should *not* be dropped from the language. Purists will
say procedure types are not needed, but then purists probably have never
calculated any integrals anyway. The bottom line: do not break away from
50 years of tradition unless you can convincingly argue there is no other
way. Or, if you break away for puristic reasons, then do not complain
people do not want to use the language anymore.

MODULE Integrand;
TYPE
  FnType * = POINTER TO RECORD
  END;
PROCEDURE (f: FnType) Calculate * (x: REAL), NEW;
BEGIN
   RETURN x*x (*just an example*)
END Calculate;
END Integrand.

MODULE Integrate;
IMPORT Integrand;

PROCEDURE Integ (
       func: Integrand.FnType;
       xMin, xMax, tol: REAL
    ): REAL;
BEGIN
   (* call func like this: func.Calculate (x) *)
END Integrate;

> If procedure types are obsolete, how do I write a library
> procedure that *requires* a functional parameter? Example:
>
> TYPE
> FnType = FUNCTION(x: REAL): REAL;
>
> FUNCTION integral( integrand: FnType; xMin, xMax, tol: REAL): REAL
>
> Sincerely,
> Rex Couture, Ph. D.
> Dept. of Earth and Planetary Sciences
> Campus Box 1169
> Washington University in St. Louis
> 1 Brookings Dr.
> St. Louis MO 63130
>
> Voice: (314) 935-4194
> Fax: (314) 935-7361
> rex{([at]})nowhere.xy


--------------------------------------------

To unsubscribe from this mailing list, send a message containing the word "unsubscribe" to:
   blackbox-request{([at]})nowhere.xy

To get a list of valid e-mail commands and instructions on their usage, send a message containing the word "help" to the above address.

Send any problem reports or questions related to this email list to the list owner at
   owner-blackbox{([at]})nowhere.xy

Current posting policy:

a) To post you should use the same address by which you are subscribed to the mailing list. That way, the list server will recognize you as subscriber and forward your posting immediately, without creating any overhead.

b) If, for some reason, you cannot post from the address, by which you are subscribed, your message will be moderated to avoid spam. Please understand that moderation will often cause some delay, in particular over weekends or holydays.


----boundary-LibPST-iamunique-829395378_-_-
Content-type: application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