Observation:
mod = Module.new
mod.name #=> ""
Maybe it would more friendly if Module#name returned nil in this case?
Then one could more easily say:
if mod.name
...
end
T.
Observation:
mod = Module.new
mod.name #=> ""
Maybe it would more friendly if Module#name returned nil in this case?
Then one could more easily say:
if mod.name
...
end
T.
Hi,
In message "Re: Module#name for anonymous modules" on Thu, 22 Jun 2006 08:08:20 +0900, transfire@gmail.com writes:
Observation:
mod = Module.new
mod.name #=> ""Maybe it would more friendly if Module#name returned nil in this case?
Then one could more easily say:if mod.name
...
end
OK. It will be for 1.9 or later.
matz.
Yukihiro Matsumoto wrote:
Hi,
>Observation:
>
> mod = Module.new
> mod.name #=> ""
>
>Maybe it would more friendly if Module#name returned nil in this case?
>Then one could more easily say:
>
> if mod.name
> ...
> endOK. It will be for 1.9 or later.
Hmm, I think it may be too indirect. You aren't really checking whether the module has a name or not, but rather if it's anonymous. Maybe an #anonymous? method for both Module and Class, in addition to #name being nil?
Cheers,
Daniel
In message "Re: Module#name for anonymous modules" > on Thu, 22 Jun 2006 08:08:20 +0900, transfire@gmail.com writes:
Isn't that the very definition of anonymous? "without a name"
- Dimitri
On 6/22/06, Daniel Schierbeck <daniel.schierbeck@gmail.com> wrote:
Hmm, I think it may be too indirect. You aren't really checking whether
the module has a name or not, but rather if it's anonymous.
Dimitri Aivaliotis wrote:
On 6/22/06, Daniel Schierbeck <daniel.schierbeck@gmail.com> wrote:
Hmm, I think it may be too indirect. You aren't really checking whether
the module has a name or not, but rather if it's anonymous.Isn't that the very definition of anonymous? "without a name"
Good point
I still think it's less mysterious to users if they could check the anonymity of a module/class with an #anonymous? method, rather than checking whether the name is nil.
Cheers,
Daniel