ruby picture

RCR 221: Automatic completion of Namespace

Submitted by rolo (Tue Feb 24 12:02:11 UTC 2004)

Abstract

There is a need to oraganize libraries with depths more 1. This tree can become quite deep. (depth > 3). To always write a fully qualified name is laborious task.

Problem

Example:

require 'Mycompany/Net/Pop'
headers = Mycompany::Net::Pop::Command.top()

It is easier to use just

require 'Mycompany/Net/Pop'
headers = Command.top()

Proposal

Allow ruby require statement to resolve namespaces.

Analysis

The initial responses from others came up with why include is insufficient. Though I do not know Ruby well, I thought that the implementators would be sensible and would not have 2 words for same thing. But I have started to work more, I see that namespace resolution using include is more like VB's <I>with</I> keyword. What I feel we should have something like Java's <I>import</I>. You can have multiple imports whereas a include removes any include done previously as far as namespace is considered.

more as I find more...

Implementation

ruby picture
Comments Current voting

The implementors (i.e., Matz) do not have two words for the same thing. require is not the same as include (which is what I assume you mean), nor is load the same as require, nor is load the same as include. I don't see any real rationale for this change here -- in fact, in all honesty I don't understand what the requested change actually is. (I don't know VB or Java so I can't comment on those; my puzzlement is based on the Ruby context.)

-- David Black


Strongly opposed 1
Opposed 0
Neutral 0
In favor 0
Strongly advocate 0
ruby picture

This RCR supersedes RCR 220.

If you have registered at RCRchive, you may now sign in below. If you have not registered, you may sign up for a username and password. Registering enables you to submit new RCRs, and vote and leave comments on existing RCRs.
Your username:
Your password:

ruby picture

Powered by .