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, [email protected] 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 M. wrote:
|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
Dimitri A. wrote:
On 6/22/06, Daniel S. [email protected] 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
On 6/22/06, Daniel S. [email protected] 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”
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs