[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Sep 10 08:22:42 1996 
Subject:Re: multiple arity method overloading 
From:Chris Dollin 
Volume-ID:960910.02 

Suresh says:

| Yes I realize that could be a problem.  I am no expert on compiler or
| interpreter design, but why not push a 'marker' on to the stack so
| that items are read from the stack until the marker is reached.

Because such a marker would have to be pushed on *all* procedure calls.
So far as the compiler is concerned, there is no difference between:

    smudge( 1, x, y );
    1, smudge( x, y );
    1, x, smudge( y );
    1, x, y, smudge();

Where and when would one push such a marker? The compiler (in general)
doesn't even know that smudge is a method that might need this action,
or an ordinary procedure that doesn't.

Also consider partial applications; if I construct smudge(% 42 %),
who's going to know to put in the marker when that gets called?

| I guess there will be a execution time penalty but the marker method
| could work.

Not, in general, in Pop.

| In that case the limitation on the final argument
| deciding which method is executed is withdrawn.  Thus one has more
| flexibility and it is the "typed" arguments that matter.
|
| I must admit I have programmed in C++ which allows this.  I wonder how
| it is done in c++.

C++ has static typing with all its disadvantages and advantages; the
compiler knows, for any method call, how many arguments its been given.
To do the same in Pop would require a rather powerful type system that would
(almost by definition) induce additional restrictions on the programs
you write.


Regards,    | ``"I can't suit myself," said Weinbaum, a little petulantly.
Kers.       | "I work for the Government".'' - Blish, "The Quincunx of Time".