From: santas@inf.ethz.ch (Philip Santas)
Subject: Re: O.M() versus M(O) notation
Organization: Dept. Informatik, Swiss Federal Institute of Technology (ETH), Zurich, CH
Date: Tue, 18 Aug 1992 21:54:40 GMT


In article <PCG.92Aug18145434@aberdb.aber.ac.uk> pcg@aber.ac.uk (Piercarlo Grandi) writes:
>On 17 Aug 92 22:26:21 GMT, santas@inf.ethz.ch (Philip Santas) said:
>
>santas> you seem to argue that functions receive more than one
>santas> arguments.
>
>Ah no, ah no. I have not committed myself on this! (even if a lot of
>people would like to commit me! :->). Here I would make the point that
>there is some difference between 'function' and 'procedure'. In the case
>of 'function' there is some disagreement, dutifully reflected in the
>syntax of ML 'procedures' for example, as to whether a function over two
>domains is really:

Can we please avoid using ''s to already hopelessly oveloaded names?
 
>       a function over a cartesian product
>       a functional over a function over one domain
>in other words, using a Lisp-like notation, whether (plus x y) is really:
>       (apply sum-of (list x y))
>       (apply (incr-by x) y)

I'm not sure if the later really does you want: it will return just 'y,
right? In my opinion you do not need to use 'apply in this case.
The correct is: ((incr-by x) y).

>santas> Well, all my functions receive one argument, and I think that
>santas> most CS scientists and mathematicians agree with this.
>
>Uhmm. But I was speaking of notation/syntax/interface. And the notation
>I was commenting about does have multiple arguments. Your observation
>applies to functions or maybe to procedures, not to their interfaces.
>Their interfarces are just syntax, notation used to access such
>procedures or their underlying functions. As such the notation used is
>not terribly important, as long as it is clear, convenient, and proper.

I think that here things are getting mixed up.
I really find pontless to start a discussion of what is syntax and what
semantics, when the one derives to the second at different levels
of abstraction. Said this, it is clear that
 "the syntax should give a clear idea of what is intended to happen"
This is why you missed the following three different cases.

>santas> I propose you to consider (and comment) the following three
>santas> cases: M (O,...) [ ... ] (O,...) M [ ... ] O M (...)
>
>This I have already done :-). Prefix, postfix, infix notation:

It is not so superficial as you try to show. I use all these cases
with the same syntax.

The first case is a function M with argument the tuple (O,...)
                     (or):   M which receives the tuple (O,...),
where we have a function M with a certain type.

In the second case we have (O,...) receiving M. It is not only superficial
change, we have the _type_ of the _tuple_ and we have added M to its 
specification.

In the third case we have O receiving M, producing an instance (function, 
object, depending to one's tastes) which operates on the tuple (...)
Here M belongs to the specification of O's type.

As one can see why have different type specifications involved.
If a tricky compiler can decide which one is better implemented,
it may choose to optimise the whole thing into something which
has nothing to do with functions or classes, but this does not change
the user's intentions, and the different methods implied by the 
three cases.

>Frankly what I really care about is not the notation itself, but the
>fact that the overload resolution agent (aka binder, dispatcher,
>messager, etc.) is given an N-uple
>       (O,M,A,B,C,...)
>which may or may not be ordered (even if usually the A,B,C,... are
>positional and thus ordered), and from this it has to find a compatible
>implementation/body/etc. to apply. 

"usually" is very sloppy here. If M is commutative then and only then
you can say that order is not important. Notice that in the 2nd and 3rd 
case the order of execution is already defined and this makes them different
than the first..

>I quite like the prefix lisp notation
>       (M O A B C ...)
>that more clearly reflects this, and is in some way just a shorthand fo
>       (apply (resolve M O A B C ...) A B C ...)
>And indeed that is the way the Lisp systems reads it.

As you have seen the problem is more than notation.
How do you resolve the case (O A M B C D ...) ?
when more than one of these arguments are functions?

It seems to me that you do not follow your _own_ definitions.
(or I may have missunderstood them :-)

Philip Santas

  "In an evolving universe those who stand still are really moving backwards"
--------------------------------------------------------------------------------
email: santas@inf.ethz.ch				 Philip Santas
Mail: Dept. Informatik				Department of Computer Science
      ETH-Zentrum			  Swiss Federal Institute of Technology
      CH-8092 Zurich				       Zurich, Switzerland
      Switzerland
Phone: +41-1-2547391
     



Xref: sparky comp.object:3273 comp.lang.clos:678