Hi
Using modules to define namespace is good and efficient?
rolo
Hi
Using modules to define namespace is good and efficient?
rolo
rolo wrote:
Using modules to define namespace is good and efficient?
Yes.
“Beware of bugs in the above code; I have only proved it correct,
not tried it.” – Donald Knuth (in a memo to Peter van Emde Boas)
In article ACEPLIKLBKEMDDIELPKIKEMGCEAA.rohitlodha@hotwireindia.com,
rolo rohitlodha@hotwireindia.com wrote:
Hi
Using modules to define namespace is good and efficient?
Sure.
Commentary: It’s interesting that we’re getting all these questions about
namespaces and modules lately.
Phil
It seems to be effective. Semantically, though, there is a bit of
weirdness in this idiomatic usage of modules.
Modules define:
These two distinct uses cause some “semantic shear,” to paraphrase Neal
Stephenson.
Taking a different view, though, these two uses can be seen as the same
thing. Modules are more than namespaces, and are thereby more flexible
while still solving the same problems as namespaces. Thus it may not be
Ruby that needs to change (to add explicit namespaces), but our
perspective of it.
I haven’t fully thought through the module v. namespace distinction,
but these are my current thoughts. Discuss
Pacem in terris / Mir / Shanti / Salaam / Heiwa
Kevin R. Bullock
On May 17, 2004, at 11:34 PM, rolo wrote:
Using modules to define namespace is good and efficient?
“Phil Tomson” ptkwt@aracnet.com schrieb im Newsbeitrag
news:c8c9rl01hvc@enews3.newsguy.com…
In article ACEPLIKLBKEMDDIELPKIKEMGCEAA.rohitlodha@hotwireindia.com,
Hi
Using modules to define namespace is good and efficient?
Sure.
Commentary: It’s interesting that we’re getting all these questions about
namespaces and modules lately.
Maybe there is a major migration of C++ developers towards Ruby going on. I
can image why that would be… :-))
robert
rolo rohitlodha@hotwireindia.com wrote:
Modules define:
1. namespaces, within which symbols are referenced
2. mix-ins, which add behavior to another module or class
Looking at this I think there are three uses:
1. namespaces, for grouping functionality
2. mix-ins, which add behavior to another module or class
3. service, like namespace but for accessing class-level methods and data
Classes themselves can be used for purposes 1 & 3.
These two distinct uses cause some "semantic shear," to paraphrase Neal
Stephenson.Taking a different view, though, these two uses can be seen as the same
thing. Modules are more than namespaces, and are thereby more flexible
while still solving the same problems as namespaces. Thus it may not be
Ruby that needs to change (to add explicit namespaces), but our
perspective of it.
Perhaps, though I tend to think separation might make for better code. It
seems strange when a class is defined within a class. It has no functional
significance. Its just something you can do if you'd like.
Barring this, I'd rather go in the other direction and have module and class
be the same thing.
I haven't fully thought through the module v. namespace distinction,
but these are my current thoughts. Discuss
Better late than never
On Wednesday 19 May 2004 03:58 pm, Kevin Bullock wrote:
--
T.