multiple arity method overloading 
Author Message
 multiple arity method overloading


I am not on pop-forum, hence any replies on comp.lang.pop appreciated

The new objectclass library in poplog 15.0 is an excellent
development.  But there is one serious limitation.  Although
procedures can be have different *types* of arguments it is not
possible to have varying *number* of arguments for a given procedure

eg 2D geometry

define translate(pt:point,dx,dy)

define translate(pt:point,refpt:point,dx,dy)

In the second case i wish to supply one more argument but this is
illegal in pop11.  The arity of the methods will depend on which
method is compiled first.

I have resorted to the rather inelegnt 'printf' way of handling
multiple arguments where I send the arguments in a list and I use a
procedure to determine the argument types and finally apply the
correct procedure.

sample procedure call :-
translate(pt,[^dx ^dy]);
translate(pt,[^refpt ^dx ^dy]);

underlying code :-
define translate(obj,arglist);          /* handling function */
   examine arguments
   decide on procedure to apply
   apply appropriate method


This messy implementation can be avoided if poplog's objectclass
allowed methods to have a varying number of arguments.  I guess this
is related to the compiler deciding how many items to read off the
stack but I am sure this can be overcome..

This is a suggestion and hope it will be taken up.


Suresh Kannan
Aerospace Engineering
University of Manchester

"Never wrestle a pig, you get dirty and it only irritates the pig"
                            - Leon the pig farmer

Thu, 25 Feb 1999 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. multiple arity method ov

2. Klass.method(:new).arity == -1 violates my POLS!

3. Method#arity problem

4. Method arity without instantiating an object

5. method arity from c

6. Arity of methods without having instance?

7. Overloading constructor methods

8. Overloading Interface Class Methods

9. method overloading?

10. not grasping the method overloading/multi-dispatch thing

11. Operator overloading and multiple arguments

12. Method overloading (option) Was: Re:


Powered by phpBB® Forum Software