@Andrew
Hi,
No, I was not actually saying that... In the class I meant this...
class Person
def man
def author
p "I am author"
end
end
end
and if I call Person.new.man.author, it gives NoMethodError.
@Matz
Hello Matz,
>>Don't use def inside of def, in general. The behavior might be
>>changed in the future (2.0 or later).
So, is it not the expected behavior of the "class" and we should not use it
or its a bug that its allowing the def inside a def(specifically only in
main object) and will be fixed in the future release. Although I haven't
read anywhere about Namespaced functions like classes and modules but I was
just curious as it was an unexpected behavior to me.
Thanks!
On Jan 8, 2008 6:14 PM, Yukihiro Matsumoto <
matz@...> wrote:
> Hi,
>
> In message "Re: Defining a function inside a function. Whats this feature
> ? How to use inside a class ?"
> on Tue, 8 Jan 2008 21:15:40 +0900, Sur <
sur.max@...> writes:
>
> |I am not sure if I have seen it being used earlier or probably I don't
> know
> |how to use it.
> |
> |when I define function(s) inside a function within the main object, it
> |works...
>
> Don't use def inside of def, in general. The behavior might be
> changed in the future (2.0 or later).
>
> matz.
>
>
--
sur
"is a String object" is a String object
hacking over objects...