newbie: help with ARITY error 
Author Message
 newbie: help with ARITY error

Keep getting this error...

;;; MISHAP - ocmpa: ARITY OF METHOD PARTS DO NOT AGREE
;;; INVOLVING:  <procedure north>
;;; FILE     :  /home/paul/oo.p   LINE NUMBER:  59
;;; DOING    :  Check_arity update_method method_form define_method
define
;;;     runproc

Receive the error message whenever i change the parameters of a
method, which i would like to do a lot at the moment as I'm trying to
learn about objects etc.

Can not find anything about this in the teach files, seems as if the
method signature  is getting cashed somewhere. The only workaround i
have is to change the method name whenever i want to change the
parameters.

Is there an easier workaround, some setting I've not enabled or am
being dumb and forgot something fundamental?

cheers

Paul



Thu, 02 Jun 2005 22:56:51 GMT  
 newbie: help with ARITY error

Quote:

> Date: 15 Dec 2002 06:56:51 -0800
> Organization: http://www.*-*-*.com/

> Keep getting this error...

> ;;; MISHAP - ocmpa: ARITY OF METHOD PARTS DO NOT AGREE
> ;;; INVOLVING:  <procedure north>
> ;;; FILE     :  /home/paul/oo.p   LINE NUMBER:  59
> ;;; DOING    :  Check_arity update_method method_form define_method
> define
> ;;;     runproc

> Receive the error message whenever i change the parameters of a
> method, which i would like to do a lot at the moment as I'm trying to
> learn about objects etc.

If you change the arity of an Objectclass method by adding or removing
parameters you'll have to alter ALL occurrences of the method in exising
code so that they are consistent with the new set of parameters.

You'll also need to cancel the old method identifier.

Example:

define :class silly;
    slot val == 0;
enddefine;

define :instance fred:silly;
enddefine;

fred =>
** <silly val:0>

define :method alterval(x:silly, y);
    y + val(x) -> val(x);
enddefine;

alterval(fred, 33);

fred =>

define :method alterval(x:silly, y, z);
    y + z*val(x) -> val(x);
enddefine;

;;; MISHAP - ocmpa: ARITY OF METHOD PARTS DO NOT AGREE
;;; INVOLVING:  <procedure alterval>
;;; .....etc.....

;;; Now cancel the method name (this removes any syntactic
;;; information previously associated with the word -- it's
;;; almost as if you had removed it from Pop-11's dictionary so that
;;; it will not be recognized thereafter.

cancel alterval;

;;; you can now define the new method

define :method alterval(x:silly, y, z);
    y + z*val(x) -> val(x);
enddefine;

alterval(fred, 33, 4);

fred =>
** <silly val:165>

See HELP CANCEL
It points to some other relevant things.{*filter*}details are in
REF IDENT and REF SECTIONS, REF WORDS

There's more information in HELP IDENTIFIERS

If you cancel an identifier and then redefine it, that will not affect
procedures already compiled using the identifier as it was before
cancellation. They will continue to access the old identifier.
So you need the following steps:

1. cancel identifier

2. redefine method

3. recompile all methods procedures using the method before
   it was cancelled.

Quote:
> Can not find anything about this in the teach files, seems as if the
> method signature  is getting cashed somewhere. The only workaround i
> have is to change the method name whenever i want to change the
> parameters.

> Is there an easier workaround, some setting I've not enabled or am
> being dumb and forgot something fundamental?

The mechanisms in Pop-11 involving words, identifiers, sections, values
of variables, are quite complex.

We need a better tutorial file than HELP CANCEL. I can't recall whether
it is explained better in any of the printed text books. Probably not.

Of course, if you exit from Pop-11 and start again, that's equivalent to
cancelling everything you've defined so far.

Aaron
====
Aaron Sloman, ( http://www.*-*-*.com/ ~axs/ )
School of Computer Science, The University of Birmingham, B15 2TT, UK

PAPERS: http://www.*-*-*.com/ (And free book on Philosophy of AI)
FREE TOOLS: http://www.*-*-*.com/



Fri, 03 Jun 2005 02:51:16 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Arity prolog - help needed!!

2. *** ARITY Prolog problem, please help ***

3. Help : 'setof/3' in ARITY PROLOG

4. Help: E-mail adress of ARITY

5. help choosing between LPA and Arity for Windows

6. Error 47 HELP Clarion Newbie

7. Newbie - Help Linker Error/Warning (NASM + ld)

8. Can anybody help a newbie with a Fatal Error problem

9. LNK2001 and LNK1120 errors.. newbie here please help

10. Syntax Error, help a newbie

11. HELP HELP HELP - round function error

12. Graphics help by newbie, please help

 

 
Powered by phpBB® Forum Software