Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!dcl-cs!aber-cs!athene!pcg From: pcg@test.aber.ac.uk (Piercarlo Antonio Grandi) Newsgroups: comp.object Subject: Re: Values and objects (was: The Emperor Strikes Back) Message-ID: Date: 11 Mar 91 15:18:01 GMT References: <3351@sequent.cs.qmw.ac.uk> <1991Mar5.225458.4408 Sender: aro@aber-cs.UUCP Organization: Coleg Prifysgol Cymru Lines: 61 Nntp-Posting-Host: aberdb In-reply-to: kers@hplb.hpl.hp.com's message of 8 Mar 91 09:25:41 GMT On 8 Mar 91 09:25:41 GMT, kers@hplb.hpl.hp.com (Chris Dollin) said: kers> Piercarlo Antonio Grandi writes: pcg> The difference is pure syntactic sugar; this is clearly illustrated pcg> in Pop-2 where any function application "f(x,y,z)" can be written pcg> equivalently as" x.f(y,z)". kers> Are you sure? No :-). Actually the example above is wrong. Damn. Let's say it is right under poetic license... :-) kers> In Pop-2's descendant Pop-11, which allows the same kind of mixing kers> of styles, the second expression is interpreted as f(y,z)(x) - ie, kers> compute an apply-able object with f(y,z) and apply it to x, rather kers> than apply f to x,y,z. In my 1971 edition (one of my proudest possessions) of the Pop-2 book on pages 10 and 11 it says that writing 'x .f' or 'f(x)' or 'x f()' is equivalent; both result in x being pushed on the stack and f's value being invoked as a function. So far so good. This would mean that 'x y z .f' (Forth style) would be equivalent to 'f(x,y,z)' and to 'x y z f()'. I am in mixed mind as to whether x.f(y,z) should be really be read as 'f(x)(y,z)' or as 'f(y,z)(x)', but I think the only test is trying it out... I'd rather like 'f(x)(y,x)', as '.' and '()' are really the same operator, only one is prefix and the other is postfix, and they should be left associative. However, whatever way this goes, I hope the point is made that the POP-2 equivalence between 'x.f' and 'f(x)' does give the impression that 'a.m(b,c)', '(m a b c)', '(a :m b c)', 'm(a,b,c)' and 'a m: b and: c' are really just different syntaxes for the same thing, or should be. Now a word from our sponsor, the League for Member Function Freedom, and the Free Overloading Foundation: Getting back to some posting of mine in comp.lang.c++, I think that the following should be made equivalent: [1] struct s { ... virtual void f(int); ... }; void s::f(int n) { ... }; ... s *s1; ... s1->f(2); ... [2] struct s { ... }; void f(virtual s &it, int n) { ... }; ... s *s1; ... f(s1,2); ... Where 'virtual' applied to a parameter implies dynamic overload resolution. Naturally I would advocate making it possible to have more than one 'virtual' parameter (The Mutant CLOS From Outer Space :->), as it is already possible to have static overloading on a single parameter. -- Piercarlo Grandi | ARPA: pcg%uk.ac.aber@nsfnet-relay.ac.uk Dept of CS, UCW Aberystwyth | UUCP: ...!mcsun!ukc!aber-cs!pcg Penglais, Aberystwyth SY23 3BZ, UK | INET: pcg@aber.ac.uk