This is a blatant help request - time is getting short ...
I have methods that calculate coefficients. Object A has its method,
object B, who is A's subclass inherits A.
Now, the method specializing on B needs to call the method
specializing on A, with its own arguments. So, I need to pass the
list of arguments. But the first argument of A's method is the
class. Do I have to specify it or will the whole method-combination
machinery figure that out?
If I need to specify it A's class, how do I identify it, knowing only
B's class?
Thanks for your help.
Mirko
From: Kenny
Subject: Re: call-next-method with arguments: what object instance do I specify?
Date:
Message-ID: <48eb86af$0$4972$607ed4bc@cv.net>
·············@gmail.com wrote:
> This is a blatant help request - time is getting short ...
>
> I have methods that calculate coefficients. Object A has its method,
> object B, who is A's subclass inherits A.
>
> Now, the method specializing on B needs to call the method
> specializing on A, with its own arguments. So, I need to pass the
> list of arguments. But the first argument of A's method is the
> class. Do I have to specify it or will the whole method-combination
> machinery figure that out?
>
> If I need to specify it A's class, how do I identify it,...
(find-class 'a) :)
>.. knowing only
> B's class?
I'll give you some meta-help, or superhelp if you prefer:
(apropos "SUPERCLASS")
I'd tell you mine but it might be different from yours.
The bad news is that the result will be named like a plural. If you only
have one, (apropos "FIRST"). If you have multiples, try (apropos "RANDOM").
hth, kt
From: Kenny
Subject: Re: call-next-method with arguments: what object instance do I specify?
Date:
Message-ID: <48eb8cb1$0$4885$607ed4bc@cv.net>
·············@gmail.com wrote:
> This is a blatant help request - time is getting short ...
>
> I have methods that calculate coefficients. Object A has its method,
> object B, who is A's subclass inherits A.
>
> Now, the method specializing on B needs to call the method
> specializing on A, with its own arguments. So, I need to pass the
> list of arguments. But the first argument of A's method is the
> class. Do I have to specify it or will the whole method-combination
> machinery figure that out?
>
> If I need to specify it A's class, how do I identify it, knowing only
> B's class?
It just occurred to me that perhaps you did not mean it literally when
you wrote that you wanted to pass the class as an argument. Your
language above "..object B, who is A's subclass..." is definitely
worrisome. You might take a moment to translate into actual runnable
code, but I know time is short. If you are just simply trying to get a
method specialized on a superclass to run you can do (call-next-method).
But it seems you want to change other parameters as well. But you cannot
invoke the method anew (I am guessing) because you will end up back in
the same method and loop.
If so, we had a chat here on this NG recently about these brave attempts
to get more out of CLOS than is healthy. One now borders on the
indeterminate dispatch of Prolog. Gosh, I wonder what code will run
when? My classes are this, the methods are that, I'm calling
call-next-method when this value is that but not this, the rules of
precedence are ...hang on, lemme check... the class precedence is..oh my...
Time is short, I suggest you add a new "do this" parameter to your
method and beat the problem into submission: Just Tell the Computer what
to do. Of course if time is /really/ short and the unsupported behavior
is what you want, sure, ship it and buy Pascal a beer.
hth, kt
On Oct 7, 12:21 pm, Kenny <·········@gmail.com> wrote:
> ·············@gmail.com wrote:
> > This is a blatant help request - time is getting short ...
>
> > I have methods that calculate coefficients. Object A has its method,
> > object B, who is A's subclass inherits A.
>
> > Now, the method specializing on B needs to call the method
> > specializing on A, with its own arguments. So, I need to pass the
> > list of arguments. But the first argument of A's method is the
> > class. Do I have to specify it or will the whole method-combination
> > machinery figure that out?
>
> > If I need to specify it A's class, how do I identify it, knowing only
> > B's class?
>
> It just occurred to me that perhaps you did not mean it literally when
> you wrote that you wanted to pass the class as an argument. Your
> language above "..object B, who is A's subclass..." is definitely
> worrisome. You might take a moment to translate into actual runnable
> code, but I know time is short. If you are just simply trying to get a
> method specialized on a superclass to run you can do (call-next-method).
> But it seems you want to change other parameters as well. But you cannot
> invoke the method anew (I am guessing) because you will end up back in
> the same method and loop.
>
> If so, we had a chat here on this NG recently about these brave attempts
> to get more out of CLOS than is healthy. One now borders on the
> indeterminate dispatch of Prolog. Gosh, I wonder what code will run
> when? My classes are this, the methods are that, I'm calling
> call-next-method when this value is that but not this, the rules of
> precedence are ...hang on, lemme check... the class precedence is..oh my...
>
> Time is short, I suggest you add a new "do this" parameter to your
> method and beat the problem into submission: Just Tell the Computer what
> to do. Of course if time is /really/ short and the unsupported behavior
> is what you want, sure, ship it and buy Pascal a beer.
>
> hth, kt
I admit, I felt really bad about that blatant help request. But my
clos experience is still limited, and though I should have "just done
it", I was felt that in case of an error, I would have no clue as
where to go.
As for beer. It is not just Pascal. There is that other Pascal, then
you, and a couple of other folks that answered many of my own posted
and unposted questions ... I owe you folks quite a lot. Thanks.
Back to clos, what I need to do is by the CLOS book (and maybe the mop
one since I'm at it).
Mirko
From: Pascal Costanza
Subject: Re: call-next-method with arguments: what object instance do I specify?
Date:
Message-ID: <6l1dfcFa8hc6U1@mid.individual.net>
·············@gmail.com wrote:
> This is a blatant help request - time is getting short ...
>
> I have methods that calculate coefficients. Object A has its method,
> object B, who is A's subclass inherits A.
>
> Now, the method specializing on B needs to call the method
> specializing on A, with its own arguments. So, I need to pass the
> list of arguments. But the first argument of A's method is the
> class. Do I have to specify it or will the whole method-combination
> machinery figure that out?
>
> If I need to specify it A's class, how do I identify it, knowing only
> B's class?
It's hard to follow your problem description, but here is what I get out
of it:
(defclass A () (...))
(defclass B (A) (...))
(defmethod m ((object A) x y)
...)
(defmethod m ((object B) x y)
...
(call-next-method object some-other-x some-other-y)
...)
This works as expected, the method combination indeed figures out the
right thing.
This works because the list of applicable methods is determined based on
the arguments you originally pass to a generic function. When invoking
call-next-method with different arguments than the original ones, this
list of applicable methods is not changed anymore. That's also why the
HyperSpec says that if your new arguments are not compatible with the
already known applicable methods that you will get undefined behavior.
So there is no need to worry about having to pass something else as the
first argument.
It may be still be that I haven't understood your problem description
well, but then you should provide more details. It always helps a lot to
post some of the code involved, to better understand your problem.
Pascal
--
Lisp50: http://www.lisp50.org
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
On Oct 7, 11:27 am, Pascal Costanza <····@p-cos.net> wrote:
> ·············@gmail.com wrote:
> > This is a blatant help request - time is getting short ...
>
> > I have methods that calculate coefficients. Object A has its method,
> > object B, who is A's subclass inherits A.
>
> > Now, the method specializing on B needs to call the method
> > specializing on A, with its own arguments. So, I need to pass the
> > list of arguments. But the first argument of A's method is the
> > class. Do I have to specify it or will the whole method-combination
> > machinery figure that out?
>
> > If I need to specify it A's class, how do I identify it, knowing only
> > B's class?
>
> It's hard to follow your problem description, but here is what I get out
> of it:
>
> (defclass A () (...))
>
> (defclass B (A) (...))
>
> (defmethod m ((object A) x y)
> ...)
>
> (defmethod m ((object B) x y)
> ...
> (call-next-method object some-other-x some-other-y)
> ...)
>
> This works as expected, the method combination indeed figures out the
> right thing.
>
> This works because the list of applicable methods is determined based on
> the arguments you originally pass to a generic function. When invoking
> call-next-method with different arguments than the original ones, this
> list of applicable methods is not changed anymore. That's also why the
> HyperSpec says that if your new arguments are not compatible with the
> already known applicable methods that you will get undefined behavior.
>
> So there is no need to worry about having to pass something else as the
> first argument.
>
> It may be still be that I haven't understood your problem description
> well, but then you should provide more details. It always helps a lot to
> post some of the code involved, to better understand your problem.
>
> Pascal
>
> --
> Lisp50:http://www.lisp50.org
>
> My website:http://p-cos.net
> Common Lisp Document Repository:http://cdr.eurolisp.org
> Closer to MOP & ContextL:http://common-lisp.net/project/closer/
you explained it perfectly!
thank you very much.
Mirko
On Oct 7, 11:57 am, ·············@gmail.com wrote:
> On Oct 7, 11:27 am, Pascal Costanza <····@p-cos.net> wrote:
>
>
>
> > ·············@gmail.com wrote:
> > > This is a blatant help request - time is getting short ...
>
> > > I have methods that calculate coefficients. Object A has its method,
> > > object B, who is A's subclass inherits A.
>
> > > Now, the method specializing on B needs to call the method
> > > specializing on A, with its own arguments. So, I need to pass the
> > > list of arguments. But the first argument of A's method is the
> > > class. Do I have to specify it or will the whole method-combination
> > > machinery figure that out?
>
> > > If I need to specify it A's class, how do I identify it, knowing only
> > > B's class?
>
> > It's hard to follow your problem description, but here is what I get out
> > of it:
>
> > (defclass A () (...))
>
> > (defclass B (A) (...))
>
> > (defmethod m ((object A) x y)
> > ...)
>
> > (defmethod m ((object B) x y)
> > ...
> > (call-next-method object some-other-x some-other-y)
> > ...)
>
> > This works as expected, the method combination indeed figures out the
> > right thing.
>
> > This works because the list of applicable methods is determined based on
> > the arguments you originally pass to a generic function. When invoking
> > call-next-method with different arguments than the original ones, this
> > list of applicable methods is not changed anymore. That's also why the
> > HyperSpec says that if your new arguments are not compatible with the
> > already known applicable methods that you will get undefined behavior.
>
> > So there is no need to worry about having to pass something else as the
> > first argument.
>
> > It may be still be that I haven't understood your problem description
> > well, but then you should provide more details. It always helps a lot to
> > post some of the code involved, to better understand your problem.
>
> > Pascal
>
> > --
> > Lisp50:http://www.lisp50.org
>
> > My website:http://p-cos.net
> > Common Lisp Document Repository:http://cdr.eurolisp.org
> > Closer to MOP & ContextL:http://common-lisp.net/project/closer/
>
> you explained it perfectly!
>
> thank you very much.
>
> Mirko
And you know what? It works ! (It does not take much to get my
amygdala excited)
Mirko
From: Kenny
Subject: Re: call-next-method with arguments: what object instance do I specify?
Date:
Message-ID: <48eb8781$0$4980$607ed4bc@cv.net>
Pascal Costanza wrote:
> .... you will get undefined behavior.
>
> So there is no need to worry...
What part of "undefined" are you not worrying about?
kt
From: Pascal Costanza
Subject: Re: call-next-method with arguments: what object instance do I specify?
Date:
Message-ID: <6l1r33F9uurtU1@mid.individual.net>
Kenny wrote:
> Pascal Costanza wrote:
>> .... you will get undefined behavior.
>>
>> So there is no need to worry...
>
> What part of "undefined" are you not worrying about?
Those who can read have a clear advantage in life.
Pascal
--
Lisp50: http://www.lisp50.org
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
From: Kenny
Subject: Re: call-next-method with arguments: what object instance do I specify?
Date:
Message-ID: <48ebc438$0$4897$607ed4bc@cv.net>
Pascal Costanza wrote:
> Kenny wrote:
>
>> Pascal Costanza wrote:
>>
>>> .... you will get undefined behavior.
>>>
>>> So there is no need to worry...
>>
>>
>> What part of "undefined" are you not worrying about?
>
>
> Those who can read have a clear advantage in life.
Sure, if you have trouble with... well, never mind, start reading about
RDF, it is pushing CLOS into the sea:
http://video.google.com/videoplay?docid=-9173722505157942928
hth,kt
From: Pascal Costanza
Subject: Re: call-next-method with arguments: what object instance do I specify?
Date:
Message-ID: <6l20ctFa9d06U1@mid.individual.net>
Kenny wrote:
> Pascal Costanza wrote:
>> Kenny wrote:
>>
>>> Pascal Costanza wrote:
>>>
>>>> .... you will get undefined behavior.
>>>>
>>>> So there is no need to worry...
>>>
>>>
>>> What part of "undefined" are you not worrying about?
>>
>>
>> Those who can read have a clear advantage in life.
>
> Sure, if you have trouble with... well, never mind, start reading about
> RDF, it is pushing CLOS into the sea:
>
> http://video.google.com/videoplay?docid=-9173722505157942928
Ja, indeed, that video is a good example...
Pascal
--
Lisp50: http://www.lisp50.org
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
From: Kenny
Subject: Re: call-next-method with arguments: what object instance do I specify?
Date:
Message-ID: <48ebddc6$0$4916$607ed4bc@cv.net>
Pascal Costanza wrote:
> Kenny wrote:
>
>> Pascal Costanza wrote:
>>
>>> Kenny wrote:
>>>
>>>> Pascal Costanza wrote:
>>>>
>>>>> .... you will get undefined behavior.
>>>>>
>>>>> So there is no need to worry...
>>>>
>>>>
>>>>
>>>> What part of "undefined" are you not worrying about?
>>>
>>>
>>>
>>> Those who can read have a clear advantage in life.
>>
>>
>> Sure, if you have trouble with... well, never mind, start reading
>> about RDF, it is pushing CLOS into the sea:
>>
>> http://video.google.com/videoplay?docid=-9173722505157942928
>
>
> Ja, indeed, that video is a good example...
>
Oh, my. Don't tell me you do not realize that RDF is more expressive
than CLOS?!
The crazy thing is that Lisp symbols already implement some of the
low-level implementation details, having both object identity and a
natural ordering, namely string<. A good weekend and--what? TripleO?
O'Triple? O^3?-- could be a reality.
It may not be an accident then that a MetaProtocol for RDF would be
inconceivable -- what's a MetaProtocol for other than "since we may have
guess wrong on what you Actually Need...".
kt
From: Pascal Costanza
Subject: Re: call-next-method with arguments: what object instance do I specify?
Date:
Message-ID: <6l25doFa8ccoU1@mid.individual.net>
Kenny wrote:
> what's a MetaProtocol for other than "since we may have
> guess wrong on what you Actually Need...".
LOL
You really don't know what you're talking about, do you?
Nevermind...
--
Lisp50: http://www.lisp50.org
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
From: Kenny
Subject: Re: call-next-method with arguments: what object instance do I specify?
Date:
Message-ID: <48ebf145$0$4873$607ed4bc@cv.net>
Pascal Costanza wrote:
> Kenny wrote:
>
>> what's a MetaProtocol for other than "since we may have guess wrong on
>> what you Actually Need...".
>
>
> LOL
>
> You really don't know what you're talking about, do you?
Pascal, you ignorant slut, I was adding Cells to Allegrostore via
multiple inheritance from two metaclasses when you were still arguing
with Gabriel about whether you should learn Lisp...wait a minute.
Can you see Russia from your house?