Need feedback on simple idea
Adam Spitz
aspitz at student.math.uwaterloo.ca
Fri Apr 11 22:18:48 UTC 2003
Stephane Ducasse wrote:
> Have you look at the implemtation because I suspect that self-message
> would imply
> method lookup while the other (no self) would imply no lookup (like
> Java private).
I haven't looked at the implementation. I'm pretty sure Ruby's "private"
is always doing lookup, though; it's not like Java's "private". Here's
some code:
class Person
private
def name
"Fred"
end
end
class PrintingPerson < Person
def printName
print(name)
end
end
p = PrintingPerson.new
p.printName # works fine
print(p.name) # raises an exception
Does that answer your question?
Adam
More information about the Squeak-dev
mailing list
|