From: Bradley J Lucier
Subject: call-next-method questions
Date: 
Message-ID: <aebuq4$fdo@arthur.cs.purdue.edu>
The Common Lisp hyperspec says that "argument defaulting [does not affect]
the values call-next-method passes to the method it calls". See

http://www.xanalys.com/software_tools/reference/HyperSpec/Body/f_call_n.htm#call-next-method

Is this a little-endian--big-endian type of thing, with arguments either way,
or are there specific and strong reasons for doing things this way.

Can other things, like assigning to an argument before calling 
call-next-method, affect which values call-next-method passes to the
method it calls?  Is call-next-method just accepted shorthand for a
standard hack that I don't quite understand?

Brad Lucier

From: Barry Margolin
Subject: Re: call-next-method questions
Date: 
Message-ID: <dGnO8.6$Pd6.104@paloalto-snr1.gtei.net>
In article <··········@arthur.cs.purdue.edu>,
Bradley J Lucier <···@cs.purdue.edu> wrote:
>The Common Lisp hyperspec says that "argument defaulting [does not affect]
>the values call-next-method passes to the method it calls". See
>
>http://www.xanalys.com/software_tools/reference/HyperSpec/Body/f_call_n.htm#call-next-method
>
>Is this a little-endian--big-endian type of thing, with arguments either way,
>or are there specific and strong reasons for doing things this way.

If the method calling CALL-NEXT-METHOD needs to force a specific value to
be used, it can do so by passing explicit arguments, instead of leaving out
all the arguments.  If the system automatically propagated the defaulted
arguments to the next method, there would be no way to get back the
behavior of allowing each method to supply its own defaults.

>Can other things, like assigning to an argument before calling 
>call-next-method, affect which values call-next-method passes to the
>method it calls?  Is call-next-method just accepted shorthand for a
>standard hack that I don't quite understand?

The idea of method combinations is that each method gets to run, pretty
much independently of the others.  CALL-NEXT-METHOD with no arguments
supports that independence.

-- 
Barry Margolin, ······@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
From: Kenny Tilton
Subject: Re: call-next-method questions
Date: 
Message-ID: <3D0A0A4E.274AA843@nyc.rr.com>
Bradley J Lucier wrote:
> 
> The Common Lisp hyperspec says that "argument defaulting [does not affect]
> the values call-next-method passes to the method it calls". See
> 
> http://www.xanalys.com/software_tools/reference/HyperSpec/Body/f_call_n.htm#call-next-method
> 
> Is this a little-endian--big-endian type of thing, with arguments either way,

Byte-order? Not sure how you got to that conclusion. anyway...

> or are there specific and strong reasons for doing things this way.

How strong are you on CLOS generic functions and :around methods and
class precedence? A GF call gets coded up, with whatever optional and
keyword arguments the coder has in mind. The methods of that GF
sometimes take a look at what is going on and handle the call
themselves, sometimes they decide not to do anything special and let
"next" methods finish up the work. The latter choice can go two ways.

First and most common (I wager), the intercepting method decides not to
interfere at all (or only to produce some side-effect). What the coder
wants is to be able to continue the call dispatch undisturbed. So they
just code up (call-next-method) and optional and keyword arguments
appear to lower precedence methods as originally coded.

The other thing the interceptor (if you will) can do is muck with the
arguments seen by ensuing methods. Now we have a puzzle. What if there
were two optional arguments? Both were supplied in the coding up of the
GF call. Somewhere in the call chain a method decides to
call-next-method with just the first optional argument? Should the
second optional argument now be considered omitted or supplied?

The spec suggests some wise folks concluded that, if one wishes to
tamper at all, one must take full responsibility and code up the
optional arguments the way you want the next method to see them. Looked
at another way, from the viewpoint of the coder of the interceptor, this
is the only scheme that works: if I have decided to tamper, I do not
want to have to write code to fight off the original call paramameters,
i just want to tamper.

> 
> Can other things, like assigning to an argument before calling
> call-next-method, affect which values call-next-method passes to the
> method it calls?

The spec you cited covered this, if I understand your Q. A simple
(call-next-method) would not be affected by setq-ing arguments in the
caller.

>  Is call-next-method just accepted shorthand for a
> standard hack that I don't quite understand?

No to "shorthand for standard hack". Overall I am not sure how much you
know about GF dispatch or where exactly your confusion was, so too soon
to judge on "don't quite understand".

:)

-- 

 kenny tilton
 clinisys, inc
 ---------------------------------------------------------------
""Well, I've wrestled with reality for thirty-five years, Doctor, 
  and I'm happy to state I finally won out over it.""
                                                  Elwood P. Dowd
From: Bradley J Lucier
Subject: Re: call-next-method questions
Date: 
Message-ID: <aed4uv$m37@arthur.cs.purdue.edu>
In article <·················@nyc.rr.com>,
Kenny Tilton  <·······@nyc.rr.com> wrote:
>Bradley J Lucier wrote:
>> Can other things, like assigning to an argument before calling
>> call-next-method, affect which values call-next-method passes to the
>> method it calls?
>
>The spec you cited covered this, if I understand your Q. A simple
>(call-next-method) would not be affected by setq-ing arguments in the
>caller.

Thank you for your reply.

I searched the spec for the effects of setq-ing arguments in the caller
and couldn't find anything about it.  Can you give me a URL?

Brad
From: Kenny Tilton
Subject: Re: call-next-method questions
Date: 
Message-ID: <3D0A2DAE.97F9931B@nyc.rr.com>
Bradley J Lucier wrote:
> I searched the spec for the effects of setq-ing arguments in the caller
> and couldn't find anything about it.  Can you give me a URL?

Like I said, it is at the URL you included in the original post:

Bradley J Lucier wrote:
> 
> The Common Lisp hyperspec says that "argument defaulting [does not affect]
> the values call-next-method passes to the method it calls". See
> 
> http://www.xanalys.com/software_tools/reference/HyperSpec/Body/f_call_n.htm#call-next-method
> 

...and there you will find:

"When call-next-method is called with no arguments, it passes the
current method's original arguments to the next method. Neither argument
defaulting, nor using setq, nor rebinding variables with the same names
as parameters of the method affects the values call-next-method passes
to the method it calls."

Is that what you are asking?

-- 

 kenny tilton
 clinisys, inc
 ---------------------------------------------------------------
""Well, I've wrestled with reality for thirty-five years, Doctor, 
  and I'm happy to state I finally won out over it.""
                                                  Elwood P. Dowd
From: Paul Wallich
Subject: Re: call-next-method questions
Date: 
Message-ID: <pw-E659EC.15570014062002@reader1.panix.com>
In article <·················@nyc.rr.com>,
 Kenny Tilton <·······@nyc.rr.com> wrote:

>Bradley J Lucier wrote:
>> I searched the spec for the effects of setq-ing arguments in the caller
>> and couldn't find anything about it.  Can you give me a URL?
>
>Like I said, it is at the URL you included in the original post:
>
>Bradley J Lucier wrote:
>> 
>> The Common Lisp hyperspec says that "argument defaulting [does not affect]
>> the values call-next-method passes to the method it calls". See
>> 
>> http://www.xanalys.com/software_tools/reference/HyperSpec/Body/f_call_n.htm#c
>> all-next-method
>> 
>
>...and there you will find:
>
>"When call-next-method is called with no arguments, it passes the
>current method's original arguments to the next method. Neither argument
>defaulting, nor using setq, nor rebinding variables with the same names
>as parameters of the method affects the values call-next-method passes
>to the method it calls."

This isn't immediately clear to me, so possibly not to others. In the 
case of methods A, B and C, where B twiddles the arguments and passes
them explicitly to B in call-next-method, and B either twiddles or 
doesn't but in any case does a call-next-method with no args to invoke 
C, what arguments does C get? The most obvious reading is that C gets 
the arguments as twiddled by A and explicitly handed to B, but I could
see a broader interpretation of "original" that would say instead that 
it gets the arguments A got. 

paul   hoping that's not the case
From: Barry Margolin
Subject: Re: call-next-method questions
Date: 
Message-ID: <FasO8.19$FJ6.277@paloalto-snr2.gtei.net>
In article <························@reader1.panix.com>,
Paul Wallich  <··@panix.com> wrote:
>In article <·················@nyc.rr.com>,
> Kenny Tilton <·······@nyc.rr.com> wrote:
>>"When call-next-method is called with no arguments, it passes the
>>current method's original arguments to the next method. Neither argument
>>defaulting, nor using setq, nor rebinding variables with the same names
>>as parameters of the method affects the values call-next-method passes
>>to the method it calls."
>
>This isn't immediately clear to me, so possibly not to others. In the 
>case of methods A, B and C, where B twiddles the arguments and passes
>them explicitly to B in call-next-method, and B either twiddles or 
>doesn't but in any case does a call-next-method with no args to invoke 
>C, what arguments does C get? The most obvious reading is that C gets 
>the arguments as twiddled by A and explicitly handed to B, but I could
>see a broader interpretation of "original" that would say instead that 
>it gets the arguments A got. 

It says "the CURRENT METHOD'S original arguments", not "the GENERIC
FUNCTION'S original arguments."  When B invokes C, the current method is B,
and its original arguments are what it received from A.

-- 
Barry Margolin, ······@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
From: Barry Margolin
Subject: Re: call-next-method questions
Date: 
Message-ID: <J4qO8.15$Pd6.131@paloalto-snr1.gtei.net>
In article <··········@arthur.cs.purdue.edu>,
Bradley J Lucier <···@cs.purdue.edu> wrote:
>I searched the spec for the effects of setq-ing arguments in the caller
>and couldn't find anything about it.  Can you give me a URL?

It's right there in the dictionary entry for CALL-NEXT-METHOD:

  When call-next-method is called with no arguments, it passes the current
  method's original arguments to the next method. Neither argument
  defaulting, nor using setq, nor rebinding variables with the same names
              ^^^^^^^^^^^^^^
  as parameters of the method affects the values call-next-method passes to
  the method it calls.

-- 
Barry Margolin, ······@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.