self

Greg Ewing look at replyto.address.invalid
Tue Jun 4 23:44:05 EDT 2002


Eric Brunel wrote:
> 
> I always
> found the C++/Java convention particularly disturbing.

If you want something really disturbing, try the
Apple Object Pascal scope rules:

  type
    Foo = object
      a: integer;
      procedure blarg(a: integer);
    end;

  procedure Foo.blarg(a: integer);
  begin
    writeln(a);
  end;

Quickly, now -- which 'a' does that write out?
.
.
.
(answer below)
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

Believe it or not, it writes the *attribute* a,
not the parameter!

-- 
Greg Ewing, Computer Science Dept, 
University of Canterbury,	  
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list