Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Call-next-method extent and usage
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  10 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Frode Vatvedt Fjeld  
View profile  
 More options Sep 12 2002, 2:19 pm
Newsgroups: comp.lang.lisp
From: Frode Vatvedt Fjeld <fro...@acm.org>
Date: Thu, 12 Sep 2002 20:19:05 +0200
Local: Thurs, Sep 12 2002 2:19 pm
Subject: Call-next-method extent and usage
The CLHS says, in the entry "Local Function CALL-NEXT-METHOD":

  [..] The function call-next-method has lexical scope and indefinite
  extent and can only be used within the body of a method defined by a
  method-defining form.

  Whether or not call-next-method is fbound in the global environment
  is implementation-dependent; however, the restrictions on
  redefinition and shadowing of call-next-method are the same as for
  symbols in the COMMON-LISP package which are fbound in the global
  environment. The consequences of attempting to use call-next-method
  outside of a method-defining form are undefined.

The relationship between extent and "can be used" is not quite clear
to me. Specifically, I'd like to know whether the consequence of the
last form in the following example is well-defined:

  (defclass super () ())
  (defclass sub (super) ())
  (defmethod m ((x super))
    'm-on-super)
  (defmethod m ((x sub))
    #'call-next-method)
  (funcall (m (make-instance 'sub)) 'foo)
  => ?

Is this an instance of "attempting to use call-next-method outside of
a method-defining form" or not?

--
Frode Vatvedt Fjeld


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Erik Naggum  
View profile  
 More options Sep 12 2002, 4:46 pm
Newsgroups: comp.lang.lisp
From: Erik Naggum <e...@naggum.no>
Date: 12 Sep 2002 20:46:34 +0000
Local: Thurs, Sep 12 2002 4:46 pm
Subject: Re: Call-next-method extent and usage
* Frode Vatvedt Fjeld
| Is this an instance of "attempting to use call-next-method outside of a
| method-defining form" or not?

  No.  You have closed over the function.

--
Erik Naggum, Oslo, Norway

Act from reason, and failure makes you rethink and study harder.
Act from faith, and failure makes you blame someone and push harder.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Barry Margolin  
View profile  
 More options Sep 12 2002, 5:00 pm
Newsgroups: comp.lang.lisp
From: Barry Margolin <bar...@genuity.net>
Date: Thu, 12 Sep 2002 21:00:58 GMT
Local: Thurs, Sep 12 2002 5:00 pm
Subject: Re: Call-next-method extent and usage
In article <2hu1kvhy06....@vserver.cs.uit.no>,
Frode Vatvedt Fjeld  <fro...@acm.org> wrote:

"Scope" refers to the binding between a name and a value.  Since you're not
referring to the name CALL-NEXT-METHOD in the FUNCALL form, nothing in the
second paragraph you quoted is relevant.  You're referring to the name
within the body of the method, so you're OK.

"Extent" refers to the usability of the value.  Since it has indefinite
extent, you should be able to call the function object at any time.

One way to think of this is that it's as if method-defining forms always
generate the following code for the method body:

(flet ((call-next-method (...) ...))
  <original-body>)

Each method body gets its own lexical function binding of CALL-NEXT-METHOD,
and you can pass these around and call them just like any other lexical
function.

--
Barry Margolin, bar...@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.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bruno Haible  
View profile  
 More options Sep 12 2002, 5:05 pm
Newsgroups: comp.lang.lisp
From: Bruno Haible <br...@clisp.org>
Date: 12 Sep 2002 22:47:31 +0200
Local: Thurs, Sep 12 2002 4:47 pm
Subject: Re: Call-next-method extent and usage

>  [..] The function call-next-method has lexical scope and indefinite
>  extent ...
>  (defmethod m ((x sub))
>    #'call-next-method)
>  (funcall (m (make-instance 'sub)) 'foo)
>  => ?

> Is this an instance of "attempting to use call-next-method outside of
> a method-defining form" or not?

The term 'outside' relates to scoping, i.e. to the textual area between
"(defmethod" and ")". Therefore capturing #'call-next-method and calling
it later, as you do here, is valid CL.

However, the argument you pass to it, namely a symbol, leads to an empty
list of applicable methods, whereas with the original argument, there
were two applicable methods. According to CLHS, you will get an error
for this.

Bruno


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim Bradshaw  
View profile  
 More options Sep 12 2002, 5:51 pm
Newsgroups: comp.lang.lisp
From: Tim Bradshaw <t...@cley.com>
Date: 12 Sep 2002 22:51:29 +0100
Local: Thurs, Sep 12 2002 5:51 pm
Subject: Re: Call-next-method extent and usage

* Erik Naggum wrote:
>   No.  You have closed over the function.

This is right, isn't it.  There must be some incredibly cool use for
this...

One think it occurs to me is that it probably makes CLOS
unimplementable in some useless formal sense that ML people will hate.
For instance if I return a closure over CALL-NEXT-METHOD, am I allowed
to change things so that a different method would be invoked before
calling it?  (Obviously not).

I have this wonderful vision of strong static typing people lurching
around going `eep, eep' and clutching the transparent covers over
their heads which then explode filling the covers with green goo while
trying to think about this.  Actually I often think of strong static
typing people like this anyway (specially the `eep, eep' bit).

--tim (two science fiction movie references in one day, I'm doing well
       here)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Espen Vestre  
View profile  
 More options Sep 13 2002, 2:24 am
Newsgroups: comp.lang.lisp
From: Espen Vestre <espen@*do-not-spam-me*.vestre.net>
Date: Fri, 13 Sep 2002 06:24:24 GMT
Local: Fri, Sep 13 2002 2:24 am
Subject: Re: Call-next-method extent and usage

Tim Bradshaw <t...@cley.com> writes:
> >   No.  You have closed over the function.

> This is right, isn't it.  There must be some incredibly cool use for
> this...

AFAIR, we actually passed around lexical closures over call-next-method
at my former job :-)
--
  (espen)

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rob Warnock  
View profile  
 More options Sep 13 2002, 2:39 am
Newsgroups: comp.lang.lisp
From: r...@rpw3.org (Rob Warnock)
Date: Fri, 13 Sep 2002 06:38:01 -0000
Local: Fri, Sep 13 2002 2:38 am
Subject: Re: Call-next-method extent and usage
Tim Bradshaw  <t...@cley.com> wrote:
+---------------
| I have this wonderful vision of strong static typing people lurching
| around going `eep, eep' and clutching the transparent covers over
| their heads which then explode filling the covers with green goo while
| trying to think about this.
+---------------

"Mars Attacks"?  ;-}

-Rob

-----
Rob Warnock, PP-ASEL-IA         <r...@rpw3.org>
627 26th Avenue                 <URL:http://www.rpw3.org/>
San Mateo, CA 94403             (650)572-2607


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Frode Vatvedt Fjeld  
View profile  
 More options Sep 13 2002, 2:59 am
Newsgroups: comp.lang.lisp
From: Frode Vatvedt Fjeld <fro...@acm.org>
Date: Fri, 13 Sep 2002 08:59:48 +0200
Local: Fri, Sep 13 2002 2:59 am
Subject: Re: Call-next-method extent and usage

Barry Margolin <bar...@genuity.net> writes:
> "Extent" refers to the usability of the value.  Since it has
> indefinite extent, you should be able to call the function object at
> any time.

It was the words "extent" and "use" that had me confused. I understand
"extent" as you put it above to refer to values' usability, but what
then precisely does the sentence ``The consequences of attempting to
use call-next-method outside of a method-defining form are
undefined.'' refer to? I now assume this refers to implementations
where call-next-method is globally fbound and what would happen with
for example a top-level (call-next-method). Thanks everyone for
putting me straight.

--
Frode Vatvedt Fjeld


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Frode Vatvedt Fjeld  
View profile  
 More options Sep 13 2002, 3:04 am
Newsgroups: comp.lang.lisp
From: Frode Vatvedt Fjeld <fro...@acm.org>
Date: Fri, 13 Sep 2002 09:04:35 +0200
Local: Fri, Sep 13 2002 3:04 am
Subject: Re: Call-next-method extent and usage

Bruno Haible <br...@clisp.org> writes:
> However, the argument you pass to it, namely a symbol, leads to an
> empty list of applicable methods, whereas with the original
> argument, there were two applicable methods. According to CLHS, you
> will get an error for this.

Yes, this was actually a typo on my part. What I intended was to call
the call-next-method closure without arguments, so the closed-over
binding of the original argument list would have to be used.

--
Frode Vatvedt Fjeld


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Barry Margolin  
View profile  
 More options Sep 13 2002, 10:48 am
Newsgroups: comp.lang.lisp
From: Barry Margolin <bar...@genuity.net>
Date: Fri, 13 Sep 2002 14:48:51 GMT
Local: Fri, Sep 13 2002 10:48 am
Subject: Re: Call-next-method extent and usage
In article <2hit1aidcr....@vserver.cs.uit.no>,
Frode Vatvedt Fjeld  <fro...@acm.org> wrote:

>Barry Margolin <bar...@genuity.net> writes:

>> "Extent" refers to the usability of the value.  Since it has
>> indefinite extent, you should be able to call the function object at
>> any time.

>It was the words "extent" and "use" that had me confused. I understand
>"extent" as you put it above to refer to values' usability, but what
>then precisely does the sentence ``The consequences of attempting to
>use call-next-method outside of a method-defining form are
>undefined.'' refer to? I now assume this refers to implementations
>where call-next-method is globally fbound and what would happen with
>for example a top-level (call-next-method). Thanks everyone for
>putting me straight.

You can't read a sentence in a vacuum.  When you read that sentence in the
context of the paragraph that contains it, you see that it's talking about
function bindings (the mention of whether it's fbound is the key), so it
must be referring to using the *name* CALL-NEXT-METHOD, not a closure over
the function.

--
Barry Margolin, bar...@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.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »